How to Deploy Your Qt Cross-Platform Applications to Windows Operating System With the Qt Installer Framework

This tutorial explains the manner to deploy cross-platform projects you made with the Qt framework ( Qt Core, Qt Widgets, and Qt Quick alike) to Windows Operating Systems using the Qt Installer Framework.

Set up the environment

  • operating system information (Windows OS)
  • a set-up of Qt Creator IDE
  • Qt code from a simple application

If you wish to get conversant with the Qt cross-platform framework, I recommend following along the courses on Udemy from the following authors:

Go deploy Qt cross-platform application using Qt Installer Framework

Step 1. Verify if Qt Installer Framework is installed on your machine, if not, then use “Qt Maintenance Tool” to add it

The Qt Installer Framework provides a set of tools and utilities to create installers for the supported desktop Qt platforms: Linux, Microsoft Windows, and macOS. Check more at :

Note: Colors and layout of the Qt Maintenance Tool UI may differ depending on your version, however, the main settings are similar

An example of a successful installation of Qt Installation Framework

We will run later the binarycreator executable to build the installer for our Qt application.

Step 2. Create a directory structure that will contain configuration files and installable packages

Create a directory structure that reflects the design of the installer and allows the installer to be extended in the future. The directory must contain the subdirectories called config and packages.

It is not important where you place the directory for deployment with Qt Installer Framework, only mind it must have this required structure.

Step 3. Create a configuration file that contains information about how to build the installer binaries and online repositories

In the config directory, create a file called config.xml with the following contents:

Notes:

  • The <Title> element specifies the installer name displayed on the title bar.
  • The <Name> element specifies the application name that is added to the page name and introduction text.
  • The <Version> element specifies the application version number.
  • The <Publisher> element specifies the publisher of the software (as shown in the Windows Control Panel, for example).
  • The <StartMenuDir> element specifies the name of the default program group for the product in the Windows Start menu.
  • The <TargetDir> element specifies that the default target directory displayed to users is InstallationDirectory in the home directory of the current user (because the predefined variable @HomeDir@ is used as a part of the value).

Step 4. Create a package information file that contains information about the installable components

In this easy scenario, the installer handles only one component that is called com.vendor.product’ . To provide the installer with information about the component, create a file called package.xml with the following contents and place it in the meta directory.

A default example of package.xml:

My example:

How to interpret the content in package.xml

The information from the following elements is displayed on the component selection page, during installation:

  • The <DisplayName> element specifies the name of the component in the list of components
  • The <Description> element specifies the text that is displayed when the component is selected
  • The <Version> element enables you to promote updates to users when they become available.
  • The <Default> element specifies whether the component is selected by default. The value true sets the component as selected.

Step 5. Add Licensing Information

The <License> element specifies the name of the file that contains the text for the license agreement that is displayed on the license check page:

Step 6. Copy whatever you want to ship to your users in the ‘package/data’ directory

Content to be installed is stored in the data directory of a component.

At this stage, copy all the files and directories which were generated with windeployqt.

Step 7. Use the ‘binarycreator’ tool to create the installer.

Copy the path to the directory of the installer.

Open the command prompt and change to the installer directory.

Verify the content of the directory:

Copy the path to the Qt Installer Framework ‘binarycreator’ file.

Execute ‘binarycreator’ command with arguments in the terminal.

This is the example for my test deployment setup (location of files, directories, etc):

C:\Qt\Tools\QtInstallerFramework\4.0\bin\binarycreator.exe -c config/config.xml -p packages whatever.exe

The result after executing this command will be the generation of an executable file which is the installer of the application.

Test run the installer

Verify the deployment directory for the installer file

Run the installer

Install the application.

Run the Application

Locate the application’s executables in the user’s home directory (I set it up like this in the config.xml within the <TargetDir></TargetDir> node).

My example of the installer does not place information in the Start Menu. Other types of installers do so.

Check for the complete list of templates with installers that can be used with the Qt Installation Framework here: https://doc.qt.io/qtinstallerframework/qtifwexamples.html

Run the app.

You may find the app in Add/Remove Programs:

10+ years of experience in a blend of mentoring, programming, business intelligence, people and logistics management :: https://www.linkedin.com/in/cgeorge1978/

Get the Medium app