I recently started working with Qt (sort of a crash course) and integrated it with Visual Studio (as described here), and now for some reason the files don't appear to be updating with my saved .ui file after making the changes in the Qt Designer.

The file is saving correctly (if I click on it in Visual Studio, it shows the added components), but none of the added components are referenced in the "ui_MainForm.h" file. Is there a step I missed somewhere along the lines of saving that should have recompiled that UI header file?

I'm also not sure if this makes a difference or not, but the generated files have a red icon next to them in the solution explorer as so:

Red icons and such

share|improve this question
up vote 5 down vote accepted

The ui_MainForm.h file does not get updated automatically as soon as you change the MainForm.ui file.

Only when you start to compile your project, the .ui file will be compiled into the .h file. If you want to update the .h file, e.g. for the sake of IntelliSense, you should be able to right click the .ui file and click "Compile". This runs uic.exe and you will have your .h file updated by that.

[Edit:]
As pointed out by rcmadruga and Summer Sun, it is sometimes necessary to additionally update your IntelliSense database by selecting the menu entry Project->Rescan Solution which was introduced with Visual Studio 2010.

share|improve this answer
1  
After renaming or adding new widgets, I also do a "Project->Rescan Solution" to force IntelliSense update. – rcmadruga Jul 7 '14 at 17:54
    
I also solve this with rescan solution, compile the ui doesn't work for me. – Summer Sun Mar 2 '17 at 5:48

The ui_*.h file gets updated after running uic.exe, which usually happens in the build process. I'm not sure about how the VS integration works, but if it's important to You to have the header updated then you can run uic manually or possibly via some menu option provided by the Qt VS Integration.

share|improve this answer

As mentioned above, you have to compile the *.ui file via Visual Studio; However if you just save and not build the form file in the Qt creator, you will not see any changes in the VS run even though you've compiled it. Thus firstly, make sure that you've built the *.ui file in the Qt IDE.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.