Why qt creator stops to update the header file for the UI?
-
I don't why but it seems that my qt creator stops to update the header file for the ui when I add some one element in the UI edit window of the qt creator.
It's like: I create a UI called userwindow in the UI design window. QT creator generates the two files for me:
userwindow.ui
ui_userwindow.h
Everything worked fine, but now, when I add some elements in the userwindow, I use @ui->@ to locate those elements,but I failed.So now, in my qt creator design window, the UIs are all right. However, I can't locate the new-added element and therefore cannot operate them.
Any one has similar experience? Or is there any method to ask qt creator to update the ui_userwindow.h file??
Many thanks.
-
After you add new elements to your user interface rebuild / run you application, and after that you should be able to see your stuff.
-
Normally saving the ui file should be enough.
Do you have other projects open in Qt Creator? There could be some interference with other ui files?
-
Thanks for the help.
-to HuxiKa
I tried rebuild and run, but it does not work.-to Eddy
I only open one project. Though, i did open several qt creators to edit a same project at the same time.
But now, I only open one creator and one project, it still does not work.-- -
i found something in the compile output:
@make: Leaving directory `/home/sz/Programming/codes/EC-build-desktop'
make: *** [userwindow.o] Error 1
The process "/usr/bin/make" exited with code 2.
Error while building project EC (target: Desktop)
When executing build step 'Make'@it seems the make cannot generate the userwindow.o.
-
The above compile error is just because the h_userwindow.ui doesnot add the elements to the header file.
-
That's weird, you could maybe try « Rebuild all » and paste the whole compilation log.
At least we'll see if uic is correctly invoked.
-
I think this issue probably derives from that I defined another class in the userwindow.h.
I try to move the definition of that class behind the definition of the userwindow class and rebuild the project, it still does not work.
-
Complier Output: (sorry about so many warnings)
@Running build steps for project EC...
Configuration unchanged, skipping qmake step.
Starting: "/usr/bin/make" -w
make: Entering directory/home/sz/Programming/codes/EC-build-desktop' /home/sz/Programming/QtSDK/Desktop/Qt/473/gcc/bin/qmake -spec ../../QtSDK/Desktop/Qt/473/gcc/mkspecs/linux-g++ CONFIG+=debug -o Makefile ../EC/EC.pro make: Leaving directory
/home/sz/Programming/codes/EC-build-desktop'
make: Entering directory/home/sz/Programming/codes/EC-build-desktop' /home/sz/Programming/QtSDK/Desktop/Qt/473/gcc/bin/uic ../EC/ec.ui -o ui_ec.h /home/sz/Programming/QtSDK/Desktop/Qt/473/gcc/bin/uic ../EC/adminwindow.ui -o ui_adminwindow.h /home/sz/Programming/QtSDK/Desktop/Qt/473/gcc/bin/uic ../EC/userwindow.ui -o ui_userwindow.h g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -I../../QtSDK/Desktop/Qt/473/gcc/mkspecs/linux-g++ -I../EC -I../../QtSDK/Desktop/Qt/473/gcc/include/QtCore -I../../QtSDK/Desktop/Qt/473/gcc/include/QtGui -I../../QtSDK/Desktop/Qt/473/gcc/include -I/usr/include/cryptopp -I. -I. -I../EC -I. -o main.o ../EC/main.cpp In file included from ../EC/adminwindow.h:8, from ../EC/ec.h:5, from ../EC/main.cpp:2: (the message has too many warnings , i have to delete them to fit in the post) make: Leaving directory
/home/sz/Programming/codes/EC-build-desktop'
make: *** [userwindow.o] Error 1
The process "/usr/bin/make" exited with code 2.
Error while building project EC (target: Desktop)
When executing build step 'Make'@ -
Sorry, you just cut the actual error message.
You must not change the ui_xxx.h files manually, as they are regenerated by uic for certain reasons.
If you move out your own class definition into another header file, make sure you
- #include that file where you included the ui_xxx.h file
- have "include guards":http://en.wikipedia.org/wiki/Include_guard in that file and make sure they are different from the other one!