Archives For November 30, 1999

This simple tutorial shows how to install and use Kvantum theme engine to change themes for your Qt5 and Qt6 applications in Ubuntu 20.04 and Ubuntu 23.10.

GNOME Desktop uses GTK toolkit for its applications and KDE/LxQt uses Qt toolkit instead. These apps work on each other desktop environment, but may NOT look native.

To unify the look and feel, Fedora Qt developer team has QGnomePlatform, adwaita-qt, and QAdwaitaDecorations projects to make Qt apps look better in GNOME. So far, only QAdwaitaDecorations is in active development for implementing Adwaita-like window header and border for Qt apps.

For Qt app window color, buttons, and other components, Kvantum is good choice to do the job.

qBittorrent (Qt6) with Kvantum theme in Ubuntu

Continue Reading…

This simple tutorial shows how to make Qt-based applications automatically change their theme to be light or dark, according to system color style in Ubuntu 22.04.

Ubuntu has global option to change system color scheme to light or dark since 22.04. However, Qt apps (e.g., VirtualBox, qBittorrent, keepassxc) always stick to their own color style, except for the title-bar.

To make Qt applications fit into GNOME environment as well as possible, Fedora Linux is working on some projects to do the job.

So far, QGnomePlatform theme is a good choice, though the upstream has been switching to QAdwaitaDecorations.

With it, your Qt applications will:

  • take use GNOME Adwaita style theme.
  • automatically switch to light or dark, depends on system color style.
  • have native header-bar and borders, even when running against Wayland

Install the QGnomePlatform Theme

The QGnomePlatform Theme package is available in system repositories since Ubuntu 23.04. Sadly, it’s built for Qt5 applications only!

For Ubuntu 22.04, I’ve made it into this unofficial PPA for amd64, arm64/hf architectures support.

To install it, press Ctrl+Alt+T on keyboard to open terminal. Then, run the 2 commands below one by one:

  1. Run command to add the PPA:
    sudo add-apt-repository ppa:ubuntuhandbook1/qgnomeplatform

  2. Then install the theme package:
    sudo apt install qgnomeplatform-qt5

NOTE: Ubuntu 23.04 and Ubuntu 23.10 users can directly run the last apt install command without adding PPA.

After installation, the new theme package should be automatically taken use for your Qt (qt5) apps. Some Qt apps use their own theme options, you have to open their ‘Preferences’ or ‘Settings’ dialog to switch to default or system theme.

If NOT, open ‘Files’ and press Ctrl+H to view hidden files. Then, click editing the ‘.profile‘ file and adding the new line below in the end:

export QT_QPA_PLATFORMTHEME='gnome'

Finally, log out and back in to apply change.

Uninstall:

You can remove the Ubuntu PPA after installation, since it will no longer receive updates. To do so, open terminal and run command:

sudo add-apt-repository --remove ppa:ubuntuhandbook1/qgnomeplatform

To remove the theme package, run:

sudo apt remove --autoremove qgnomeplatform-qt5

Also remember to restore the .profile file in your user home.

Your apps do NOT have window border and shadow in Ubuntu 23.10? Here are the quick workarounds for the applications based on Qt UI toolkit.

In Linux Desktop, applications are built with different UI toolkit. While, GNOME, Cinnamon, and XFCE use GTK3/4, KDE and LxQt use Qt for their applications.

Ubuntu by default uses GNOME as default desktop environment, but user may also use Qt applications, such as qbittorrent, ksnip screenshot tool, kdenlive video editor, and more.

In Ubuntu 23.10, the Qt applications are looking weird. They have very thin border without shadow, that look kinda borderless. This is an upstream issue that also happen in Debian 12 bookworm.

Qt apps in Ubuntu 23.10

If you have similar issue, then this tutorial is going to show you how to fix (workaround) it by 2 ways:

  • xcb QPA plugin – for Qt apps run against X11.
  • QGnomePlatform Theme – Qt app inclusion in GNOME, but lack Qt6 support in Ubuntu so far.

NOTE: You can do both ‘Option 1’ and ‘Option 2’ in Ubuntu. They do not conflict with each other.

Option 1: Set xcb QPA environment

If most of your Qt apps are running against X11, then this option is a good choice.

1. Simply open “Files“, press Ctrl+H to show hidden files/folders.

Then find out the .profile file, right-click on it and select “Open With Text Editor”.

2. When the file opens, scroll down and add the new line below in the end:

export QT_QPA_PLATFORM=xcb

After saving the file, log out and back in. Then, try launching your Qt applications to see the result.

Tips: without log out and back in, you may press Ctrl+Alt+T to open terminal. Then run command export QT_QPA_PLATFORM=xcb to set the environment for this terminal window. Finally, launch Qt app from this terminal.

Option 2: Use QGnomePlatform Theme

Fedora Linux has QGnomePlatform project to allow Qt applications to fit into the GNOME environment as well as possible, though it’s no longer maintained due to switch to QAdwaitaDecorations.

The theme works great, and even let your Qt apps automatically switch between light and dark mode according to desktop color style.

Ubuntu 23.04 and Ubuntu 23.10 include the package in system repository, sadly for Qt5 apps only!

1. First, press Ctrl+Alt+T on keyboard to open terminal. When terminal opens, run command to install the theme package:

sudo apt install qgnomeplatform-qt5

2. Next, also open “Files”, press Ctrl+H to view hidden files. Then, edit the ‘.profile‘ file and add new line in the end:

export QT_QPA_PLATFORMTHEME='gnome'

Finally, log out and back in to apply change.

After doing both ‘Option 1’ and ‘Option 2’, all my Qt applications have native window borders, though the Qt6-based qBittorrent is still not fitting well in GNOME.

Qt apps in Ubuntu 23.10 after this tutorial

Run Qt app against Wayland

After doing ‘Option 1’, your Qt applications will run against X11.

If you do need to run app against Wayland, then either launch the app from terminal. For example, launch kdenlive using wayland:

env QT_QPA_PLATFORM=wayland kdenlive

Tips: some apps may be running silently in the background. You need to close it first before running the similar command above.

Or, edit the app shortcut file (usually under /usr/share/appliations), and set the environment by changing the value of ‘Exec’.

For example, edit the app shortcut for Kdenlive, to make it run against wayland:

sudo gnome-text-editor /usr/share/applications/org.kde.kdenlive.desktop

Qmmp Qt-based multimedia player

Qmmp, a Qt-based multimedia player with Winamp-Like user interface, has reached the 1.1.0 (Qt5) and 0.10.0 (Qt4) releases with many new features, performance improvements, bug fixes, and translations updates.

Qmmp 1.1.0 and 0.10.0 features:

  • new internal audio converter
  • MacOS X support
  • wildmidi 0.4.0 support
  • support for XMIDI and MUS (id Software) formats
  • new plugin: soxr-based resampler plugin, Qt Multimedia output plugin, WASAPI output plugin.
  • multi-thread support in the audio converter plugin
  • https support in the http plugin
  • feature to scrobble http streams
  • and more…

The new releases also bring improvements to skinned interface, simple user interface (qsui), wavpack, ffmpeg, ladspa, and DirectSound output plugins. Following issues has been fixed:

  • unity/compiz support
  • metadata encoding issue in the http plugin
  • unicode support under windows
  • disc number parsing

Qmmp 1.10.0

How to install Qmmp 1.1.0 or 0.10.0 in Ubuntu:

1. Add PPA.

Open terminal (Ctrl+Alt+T), paste the command below and hit run:

sudo add-apt-repository ppa:forkotov02/ppa

qmmp-ppa

Type in password (no visual feedback) when it asks and hit continue.

2. Update package caches.

Checking for updates via Software Updater or by running the command below in terminal:

sudo apt update

If you have a previous Qmmp version installed, just upgrade it via Software Updater.

3. To install Qmmp run command:

sudo apt install qmmp qmmp-plugin-pack

The command will install Qmmp 0.10.0 (Qt4 version) in Ubuntu 12.04, Ubuntu 14.04, Ubuntu 15.10 and their derivatives. For Ubuntu 16.04, the 1.1.0 (Qt5 version) will be installed.

To install Qt4 version in Ubuntu 16.04, run command:

sudo apt install qmmp-qt4 qmmp-plugin-pack-qt4