0

I am trying to compile a .pro file using qmake and Qt4 to get a library from qttestrunnerlib.pro but I get this error:

~/docs/UT_Cpp_Test/main/cppDir/src/qttestrunner$ qmake qttestrunnerlib.pro 
uic: Error in line 6, column 14 : Unexpected element name
uic: Error in line 6, column 14 : Unexpected element name

When I use Qt3 it works, and I get my lib successfully. But I want to upgrade it to Qt4. Is it possible? and what should I do?

Mat
  • 202,337
  • 40
  • 393
  • 406
Oumaya
  • 655
  • 4
  • 18
  • 43

2 Answers2

2

I've used uic3 from the qt3-support package (on gentoo at least)

uic3 -convert ui-file-qt3.ui -o ui-file-qt4.ui

Pierre GM
  • 19,809
  • 3
  • 56
  • 67
1

That is because the designer in qt4 is different from qt3. means ui files generated by qt3 and qt4 are not the same. That's why the unexpected element name error!

The uic reads a user interface definition (.ui) file in XML as generated by Qt
Designer and creates corresponding C++ header or source files.

Easiest way to solve is, use your qt4 ide to open you form and it will ask for 
conversion.Then use the newly created ui for your compilation. 
ScarCode
  • 3,074
  • 3
  • 19
  • 32
  • thank you for your answer, do you mean that I should open every file .ui with an ide (can I use qt creator) an reuse the converted files in my compilation or what? – Oumaya May 25 '12 at 09:02
  • Ya you need to convert it to qt4 compatible ui by opening it with qtcreator. Or try uic -o MyGUI.h MyGUI.ui provided you have qt4 environment. For building projects you don't need gui.ui, it only needs ui_gui.h. – ScarCode May 25 '12 at 09:21
  • Sorry but I tried to open it with qtcreator but in vain it didn't accept it, I try `uic -o MyGUI.h MyGUI.ui ` but I get the same error `~/docs/UT_Cpp_Test/main/cppDir/src/qttestrunner$ uic -o testbrowserdlg.h testbrowserdlg.ui uic: Error in line 6, column 14 : Unexpected element name File 'testbrowserdlg.ui' is not valid ` – Oumaya May 25 '12 at 11:05
  • Try opening the entire project with qt4 qtcreator using .pro file – ScarCode May 25 '12 at 11:40
  • ya that what I did I opened the .pro in qtcreator then I tried to open testbrowserdlg.ui, with double click on the file there is an error and with qt Designer it tell me that it is'n a valid UI designer file !!!!!!!! – Oumaya May 25 '12 at 12:45
  • ok do one thing. use your ui_gui.h file generated by qt3 to build your project in qt4, so that qt4 don't need to process different ui. this would solve your problem temporarily. – ScarCode May 25 '12 at 12:49