qtchooser
Choose between multiple installed Qt versions
TLDR
List available Qt versions from the configuration files
Print environment information
Run the specified tool using the specified Qt version
Add a Qt version entry to be able to choose from
Display help
SYNOPSIS
qtchooser [-list] [-print-env [-qt
PARAMETERS
-list
Lists the available Qt versions registered with qtchooser.
-print-env [-qt
Prints the environment variables needed to use the specified Qt version. If -qt is omitted, it prints the environment for the default Qt version.
-run-tool
Runs the specified Qt tool (e.g., qmake, moc) using the specified Qt version. If -qt is omitted, it uses the default Qt version.
The tool must be in the Qt version's bin directory.
-graphic
Shows a graphical frontend if available.
DESCRIPTION
qtchooser is a command-line tool used to select and configure the Qt development environment to be used on a system with multiple Qt versions installed. It allows developers to easily switch between different Qt versions and profiles (e.g., Qt 4, Qt 5, Qt 6; desktop, embedded) and ensure that the correct tools and libraries are used for building Qt-based applications. This is crucial when a system has multiple Qt installations, as it avoids conflicts and ensures compatibility. qtchooser reads configuration files located in /etc/xdg/qtchooser and $HOME/.config/qtchooser. These files contain information about the installed Qt versions, including paths to binaries (qmake, moc, etc.), libraries, and include files.
It uses an alias system allowing users to define shortcuts for each Qt version. The alias can be used instead of the full path to the Qt installation. By using qtchooser -print-env, the environment variables are displayed that are used by the given Qt version.
CAVEATS
The effectiveness of qtchooser depends on correct configuration files being present for each Qt version. Incorrect or missing configuration can lead to unexpected behavior or errors.
CONFIGURATION FILES
Configuration files are found in /etc/xdg/qtchooser/*.conf and $HOME/.config/qtchooser/*.conf.
Each configuration file contains the path to the Qt binaries and the path to the Qt libraries. Example:
/opt/qt5/bin
/opt/qt5/lib
SEE ALSO
qmake(1)