QtCreator Build doesn't update UI changes in design form

微笑、不失礼 提交于 2020-05-13 04:16:09

问题


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?


回答1:


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.




回答2:


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.




回答3:


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



来源:https://stackoverflow.com/questions/29341724/qtcreator-build-doesnt-update-ui-changes-in-design-form

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!