kietheros
kietheros

Reputation: 463

QtCreator Build doesn't update UI changes in design form

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?

Upvotes: 8

Views: 7167

Answers (5)

user28648665
user28648665

Reputation: 1

Had the same issue: removed elements in mainform.ui, recompiled and ran the app. The changes didn't show up. I noticed that ui_mainwindow.h appeared in the project list under "headers". Removed this (with "delete from disk") and everything worked just fine. ui_mainwindow.h showed up newly built in the build directory, where it belongs. So I had two versions of this file, one still defining the form before editing.

Upvotes: 0

Gustavo Rodríguez
Gustavo Rodríguez

Reputation: 869

This problem occurred when I migrated my project from QtCreator 3.1.x to 12.0.1, when I modified the GUI the changes were not reflected in the application. It did not make sense because when reviewing the contents of the .ui file there were the changes, deleting the makefiles, the moc* intermediate files, etc had no effect.

Finally, I discovered the shadow build option in Build settings, if you uncheck this option the problem is solved. I know it doesn't make sense but it works.

You may get the error: C1041: can't open the databases of the program ... If several cl.exe write in the same file .PDB, use /FS which is solved with the indicated flag (/FS) inserting in the .pro QMAKE_CFLAGS+=/FS

Upvotes: 0

user1092803
user1092803

Reputation: 3277

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

Upvotes: 0

Jun Hong
Jun Hong

Reputation: 21

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.

Upvotes: 2

Richardson Ansong
Richardson Ansong

Reputation: 790

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.

Upvotes: 0

Related Questions