6

My Qt project uses shadow build.
When I change in MainWindow form ( .ui file), I build the project but my program doesn't update GUI.
If I rebuild all, GUI will be updated. But rebuild is very very slow.
I try creating a new project (an empty QMainWindow with some labels), I modify some texts. I build and GUI is updated.

How can I use shadow build correctly, without a rebuild of all my project?

Anthon
  • 69,918
  • 32
  • 186
  • 246
shang12
  • 423
  • 5
  • 18
  • You should re-try to create a new graphical project using shadow builds. This will check if the issue is on shadow builds in general or only in your project. I think the error is in your .pro file, or something similar (do you use CMake, qmake, anything else ?) – Antwane Mar 30 '15 at 10:12
  • I'm having a similar issue and this seems like a bug to me. See my comment in this thread: http://stackoverflow.com/questions/4382652/qt-designer-does-not-update-the-gui – rusty Oct 13 '16 at 21:37
  • I have the same problem. It happened because I used QT Designer and also the QT Creator. When using QT Creator, everything is fine. But once I use QT Designer and use this tool to update the ui_*.h file, QT Creator stops updating the file. I tried the solutions of this l – Flavio de Castro Alves Filho Jun 30 '20 at 15:07

3 Answers3

2

The same issue occurs if the *.ui file name is changed.

For example, Changing yourUi.ui to myUi.ui.

If that is the scenario, then the ui_*.h should also be changed, that is, yourUi.ui to ui_myUi.h.

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
Jun Hong
  • 21
  • 3
0

Have you tried to just run qmake (Build -> Run qmake) ?

Edit
As suggested by a comment, I copied the comment to preserve it.
It seems that QtCreator correctly rebuild the .h file of the ui in the shadow build directory, and then include the ones in the source directory, which is not regenerated. I don't know if this is a bug or an intended behaviour, but a quick workaround can be to build the project in the shadow build directory, copy the generated .h files back in the source directory and rebuild again. This work with my simple project, don't know if can be workable also for bigger and more complex project. Or do not use shadow builds

Gianluca
  • 3,227
  • 2
  • 34
  • 35
  • To complete the previous comment. It seems that QtCreator correctly rebuild the .h file of the ui in the shadow build directory, and then include the ones in the source directory, which is not regenerated. I don't know if this is a bug or an intended behaviour, but a quick workaround can be to build the project in the shadow build directory, copy the generated .h files back in the source directory and rebuild again. This work with my simple project, don't know if can be workable also for bigger and more complex project. Or do not use shadow builds – Gianluca Mar 30 '15 at 11:57
  • Kindly consider [edit]ing your answer to add the previous comment. Comments might be deleted, however the answer remains. Thank you. – Bhargav Rao Nov 12 '16 at 16:29
0

close Qt creator, go to your project directory and delete the .pro.user file, open the project again and this time Qt creator will ask you to configure your project by choosing the kit you use to build your project. Select the appropriate kit and press the "configure project" button. Apply your shadow build. I hope it will work.

  • After selecting a kit, build = rebuild all. It works, but if I change UI again, build, my program still runs with old GUI. – shang12 Mar 30 '15 at 11:20
  • Give focus to your .ui file in the project tree then Go to Build->Build File "your UI.ui" – Richardson Ansong Mar 30 '15 at 13:35
  • When I modify ui file, I build my project, I check ui_mainwindow.h, code in this file has been updated but my program still runs with old UI. – shang12 Mar 30 '15 at 16:57