Running UIC on .ui files on Visual Studio
-
I have a complicated Qt Widgets GUI written on Linux.
To compile it with Visual Studio for Windows, I created a Visual Studio Project From Existing Code. After the project was created, I added in the .ui form files to the project.When I compile the project, uic does not run and the ui_ headers and moc files are not being created. Consequently, the project does not find the ui_ headers.
How can I configure Visual Studio 2022 to make it run the Qt uic on the .ui files in the project as a build step please?
-
I have a complicated Qt Widgets GUI written on Linux.
To compile it with Visual Studio for Windows, I created a Visual Studio Project From Existing Code. After the project was created, I added in the .ui form files to the project.When I compile the project, uic does not run and the ui_ headers and moc files are not being created. Consequently, the project does not find the ui_ headers.
How can I configure Visual Studio 2022 to make it run the Qt uic on the .ui files in the project as a build step please?
Use a build system like CMake and/or add the
Qt VS Tools for Visual Studio 2022
to your VS Plugins.For CMake, see
- https://cmake.org/cmake/help/latest/prop_tgt/AUTOUIC.html
- https://cmake.org/cmake/help/latest/prop_tgt/AUTOMOC.html
Don't you use CMake for your Linux build?! Why not use the same configuration (well or at least similar when there is OS specific stuff)?
@Thaxila said in Running UIC on .ui files on Visual Studio:
After the project was created, I added in the .ui form files to the project.
Also: Include the
*.ui
files in your project, don't just move them afterwards -
Are the
.ui
files correctly catalogued as "Form Files" in the solution explorer? What's your Qt Project Settings?
Years ago when I was using quite old Qt & VS I had met similar problem and clear/reset the Qt version in the project setting could solve that. Not sure if this would work on your case.