Improve Qt Interfaces on GTK-based Systems

Back to SecondFaqtor

If you use a desktop environment that isn't Qt-based, you can still make Qt-based applications such as SecondFaqtor render in a nearly-identical style to the rest of your system, using the Qt5 Configuration Tool, qt5ct. This guide will walk you through installing and configuring qt5ct and the gtk2 platform theme.

qt5ct

The first thing that needs to be installed is qt5ct, which is available as a standard package for most every flavor of GNU/Linux. Check your Software Manager UI or use your favorite package management utility to install the package "qt5ct".

Once qt5ct is installed, open it by typing "qt5ct" into a terminal or by finding Qt5 Settings in your system menu. If a banner is shown across the top of the Configuration Tool which says "The application is not configured correctly." then you will need to make some adjustments to your environment variables.

Environment Variables

To use the preferences chosen in qt5ct, you must use qt5ct as your platform theme. To make this adjustment, please edit your "~/.profile", "~/.bashrc", or "~/.xinitrc" file:

If an environment variable entry already exists for "QT_QPA_PLATFORMTHEME", please change the value of the variable to "qt5ct". Otherwise, run a command like this to add it:
echo "export QT_QPA_PLATFORMTHEME=qt5ct" >> ~/.profile

If an environment variable entry exists for "QT_STYLE_OVERRIDE", please delete it. Otherwise, run a command like this to unset it:
echo "unset QT_STYLE_OVERRIDE" >> ~/.profile

After making a change to the environment variables, please log out and log in again, or restart your computer. The banner in qt5ct should not show up if your configuration is correct, and choosing a Style in the Appearance tab should change the Configuration Tool's interface immediately on applying. If there's a problem, you can click "Information" for more details on what needs to be fixed.

GTK 2 Platform Theme

Depending on your distribution, the gtk2 theme may already be a listed Style in the Appearance tab. If not, please try installing the following additional packages:

After the right package is installed, "gtk2" should show up in the Style dropdown of qt5ct. Please make sure to close qt5ct before installing, or restart the program afterward to update the list.

Choose the "gtk2" theme and make sure the preview loads successfully before applying the theme. If there is any problem with the GTK theme, falling back to "Fusion" is recommended.

Testing and Tweaking

Once your Qt5 theme is selected, try opening an application that uses Qt, such as SecondFaqtor, to see how the theme actually looks. If there are coloring or sizing issues, please make adjustments in qt5ct after closing the program you're testing with.

If you use a dark theme and certain elements have bad background or text colors using either "gtk2" or "Fusion" styles, try enabling a Custom Palette and choosing the "darker" Color scheme.

If the interface seems too large or too small, check the Fonts tab of qt5ct. On average, the font size should be set to 10, and should probably never be larger than 12. Be sure to choose a font variant of "Medium" or "Book".

In some cases, the icon colors may not stand out well against the window background color; Check the Icon Theme tab of qt5ct to choose an icon set that will stand out clearly.

Notes

Please keep in mind that there are many other ways to control your Qt5 Style preferences, and many additional styles to use. The instructions and notes described on this page are a basic starting-point for configuring Qt5, and your Linux distro may provide alternate tools, styles, or color palettes that may work better or take less resources. Please consult your distribution's documentation for more details about Styles and Qt5.


« Home Applications Pale Moon Extensions Themes Tools »

Security Privacy