Qt

From Gentoo Wiki
Jump to:navigation Jump to:search
This article is a stub. Please help out by expanding it - how to get started.

Qt (pronounced as /ˈkjuːt/ "cute") is a cross-platform application framework that is widely used for developing application software with a graphical user interface (GUI) (in which cases Qt is classified as a widget toolkit), and also used for developing non-GUI programs such as command-line tools and consoles for servers. [1]

In Gentoo, the ebuilds for Qt and related packages are maintained by a dedicated team. This team also maintains the official qt overlay. They are very open to user contributions and volunteers who want to become new developers.

Installing the Qt libraries

Most users will not need to install the Qt libraries intentionally, but can just let them be pulled in as dependencies of the applications they want to use. For those who want the complete set (e.g. for software development purposes), there are sets in the overlay for Qt5.

Qt-based desktop environments

There are currently two Qt-based desktop environments available in Gentoo. The most well-known and best developed one is KDE Plasma. There is also a younger and more "light-weight" DE: LXQt (a merge of Razor-Qt and LXDE). These can be complemented with KDE Applications and packages from the Qt Desktop applications list.

Compiling programs that use qmake and need Qt5

Programs that need Qt5 will need its version of qmake. It is located in /usr/lib/qt5/bin and needs to be executed with its full path (i.e., /usr/lib/qt5/bin/qmake). After it's run, compilation will just work.

Alternatively, one can use dev-qt/qtchooser functionality in the development environment. Start with:

user $qtchooser --help

Theming

In the context of Qt, a theme is a particular combination of 'style', 'icon theme', and 'color theme'.

The default style of KDE Plasma is Breeze, provided by the kde-plasma/breeze package; the Breeze icon theme is provided by kde-frameworks/breeze-icons. A 'Breeze' theme is also available for GRUB (kde-plasma/breeze-grub) and Plymouth (kde-plasma/breeze-plymouth).

There doesn't appear to be any XDG directory specification for themes in general (although there is a specification for icon themes in particular). However, common locations for themes include $XDG_DATA_HOME/themes/ and ~/.themes/.

Qt theming outside of KDE

The primary way to theme Qt applications in a non-KDE environment is qt5ct, provided by the x11-misc/qt5ct package. To use it, ensure that the QT_QPA_PLATFORMTHEME is set to qt5ct in your environment, e.g. via ~/.bash_profile:

FILE ~/.bash_profile
export QT_QPA_PLATFORMTHEME=qt5ct

Themes, as well as things such as preferred fonts, can then be selected by running qt5ct and/or qt6ct; the theming of individual applications depends on whether they were linked against Qt5 or Qt6. Note that setting QT_QPA_PLATFORMTHEME to qt5ct is sufficient to activate theming of Qt6 applications; it's not necessary to set that variable to qt6ct in such cases.

By default, chosen settings are saved to the $XDG_CONFIG_HOME/qt5ct/ directory (e.g. /home/larry/.config/qt5ct/), which is referenced by Qt applications during startup.

However, it is also possible to directly specify a theme without using qt5ct, by setting the QT_STYLE_OVERRIDE variable in your environment, e.g.

FILE ~/.bash_profile
export QT_STYLE_OVERRIDE=adwaita

Additionally, it is possible to pass a style name directly to a Qt application by using the -style option. For example, to use the adwaita-dark style (x11-themes/adwaita-qt) with Wireshark:

user $wireshark -style adwaita-dark

Kvantum

Kvantum (x11-themes/kvantum) is an SVG-based system that provides a 'kvantum' Qt style instead of a platform theme, and then allowing the selection of specific Kvantum styles via the Kvantum system. It can be used by selecting "kvantum" as the style in qt5ct, or by setting the QT_STYLE_OVERRIDE environment variable (described above) to kvantum.

Kvantum styles can be previewed and selected by running the kvantummanager program (or simply previewed by running the kvantumpreview program). As of Kvantum 1.1.2, these programs are only built and installed if the kde USE flag is enabled on the x11-themes/kvantum package.

Frequently asked questions

Please see the Qt/FAQ page.

External resources

References