2012-05-25 36 views
0

我試圖用qmake以及Qt4擺脫qttestrunnerlib.pro庫編譯.pro文件,但我得到這個錯誤:當我使用QT3它的工作原理UIC:意外的元素名稱

~/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 

,我讓我的lib成功。但我想升級到Qt4。可能嗎?我該怎麼辦?

回答

1

這是因爲qt4中的設計師與qt3不同。意味着由qt3和qt4生成的ui文件不相同。 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. 
+0

謝謝你的回答,你的意思是我應該打開每個文件的.ui與IDE(我可以使用QT創建者)重新使用我的彙編中的轉換文件還是什麼? – Oumaya

+0

你需要通過用qtcreator打開它來將它轉換爲qt4兼容的UI。或者試試uic -o MyGUI.h MyGUI.ui提供了你有qt4的環境。對於構建項目你不需要gui.ui,它只需要ui_gui.h。 – ScarCode

+0

對不起,但我試圖用qtcreator打開它,但它沒有接受它,我嘗試'uic -o MyGUI.h MyGUI.ui'但我得到了同樣的錯誤〜/ docs/UT_Cpp_Test/main/cppDir/src/qttestrunner $ uic -o testbrowserdlg.h testbrowserdlg.ui uic:第6行,第14列出錯:意外的元素名稱 文件'testbrowserdlg.ui'無效 ' – Oumaya

2

我用uic3qt3-support包(Gentoo上至少)

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