Building

Qt Visual Studio Tools includes MSBuild rules and targets specific to Meta-Object Compiler (moc), User Interface Compiler (uic), and Resource Compiler (rcc). These rules are referred to as Qt/MSBuild. They enable running moc, rcc and uic in parallel processes and setting build options, such as selecting project items to process and the tools to process them. Further, source files generated by the Qt tools are added to the C++ compilation during the build process, so that generated files do not need to be included in projects.

The options for each Qt tool can be set either globally at project level or for specific files. To set global options for handling files at project level:

  • Select Properties in the context menu of the project.
  • Select Extensions > Qt VS Tools > Qt Project Settings.

"Qt Project Settings"

To set options for handling a specific file, select Properties in the context menu of the file. Only tools relevant for the file type are listed. For example, moc options are available for C++ source and header files, whereas uic options are available for UI forms (.ui).

When importing .pro files, custom build steps are automatically converted into Qt/MSBuild steps. To convert custom build steps into Qt/MSBuild steps for a solution, select Qt > Convert custom build steps to Qt/MSBuild in the context menu of the solution.

To set the path to the Qt/MSBuild files, select Extensions > Qt VS Tools > Options > Qt/MSBuild. This corresponds to setting the value of the QTMSBUILDS environment variable.

© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.