4

Similar to this question: Qt Creator: Design changes not showing when run

I cannot make a simple change in the UI and then see it when I run. I've tried adding a dummy label and push button. No matter how much I edit the MainWindow.ui file, I can not get the UI to change. The ui_MainWindow.h file also does not change. It seems like whatever is supposed to generate that file is not being run.

I've tried cleaning before I run. I've tried unchecking the 'Shadow build' option under Projects >> Build & Run >> General >> Shadow build checkbox and then restarting Qt Creator. I've tried restarting my PC and then testing. That damn ui_xxx file will not update!

Host OS: Windows 7, 64b Qt Creator version: 3.0.1 based on QT 5.2.1 (MSVC 2010, 32 bit), built on Jan 31 2014

Community
  • 1
  • 1
tarabyte
  • 17,837
  • 15
  • 76
  • 117
  • 2
    If you delete the ui_MainWindow.h from the build directory it should be regenerated the next time you run qmake (QtCreator should do that automatically) – Tim Meyer Apr 03 '14 at 05:21
  • In Creator, there is a preview under Forms/Preview. Does that show the differences? – ExpatEgghead Apr 03 '14 at 06:09
  • Have you tried _Run qmake_? – Zlatomir Apr 03 '14 at 08:19
  • @Zlatomir, Where would i run a command line? How can execute that? I'm pretty new to Qt. – tarabyte Apr 03 '14 at 15:52
  • You can find that in the _Build_ menu in Qt Creator – Zlatomir Apr 03 '14 at 15:53
  • @ExpatEgghead, Forms is not a toolbar item in Qt5. I have a Forms logical directory in the 'Projects' inspector. My MainWindow.ui lives there and I can open that fine and add buttons and such, but these do not show up. – tarabyte Apr 03 '14 at 16:06
  • Good point @TimMeyer, but even though I delete the ui_MainWindow.h, clean project, run qmake on project, I still can't generate a new ui_MainWindow.h and the application still runs as it did before! Yes, I am looking in the correct directory. – tarabyte Apr 03 '14 at 16:06
  • Hm no clue then. You should have a "qmake" option available when right-clicking your project in the "Edit" area in Qt Creator though – Tim Meyer Apr 04 '14 at 06:34
  • possibly your answer : http://stackoverflow.com/a/15616946/2736559 – Hossein Sep 24 '15 at 14:21
  • https://stackoverflow.com/questions/4382652/qt-designer-does-not-update-the-gui – Thomas Jan 21 '19 at 23:03

4 Answers4

12

One reason for this buggy behavior is the Shadow build checkbox is enabled. Click on the "Project" icon in the Qt creator, under Build-> General, uncheck Shadow build. Rebuild again and run.

osbuilder
  • 196
  • 2
  • 6
  • That fixed my problem. Not the problem is how to get this behavior without disabling shadow builds. – TOP KEK Oct 10 '16 at 00:27
1

After modifying UI elements on a project what worked for me was to delete the directory: {project dir}/GeneratedFiles followed by a project rebuild.

UI elements including menu changes seem to work after deleting. I tried the clean followed by rebuild, including unchecking the shadow build.

Qt Creator 4.11.0

Tim P
  • 69
  • 1
  • 9
0

Just had the same issue. Delete (or at least put it somewhere else) the ui_*.h file, and recompile the program. It fixed for me.

0

sk313tOn is correct. For shadow-build delete ui_mainwindow.h in your project directory. Because for shadow-build the correct location of ui_mainwindow.h is the build directory! ui_mainwindow.h will be build in the build directory automatically.

mireiner
  • 1
  • 2