Include qt5-style-plugins into the default installation, otherwise Qt5 apps don’t pick up the GTK+ style

Bug #1695618 reported by Andrej Shadura
52
This bug affects 11 people
Affects Status Importance Assigned to Milestone
qtbase-opensource-src (Ubuntu)
Won't Fix
Undecided
Unassigned

Bug Description

In Artful and Bionic, Qt5 applications look alien because they don’t follow the GTK+ style.
For Qt5 applications to pick up the GTK+ style, qt5-style-plugins must be included into the default installation and “export QT_QPA_PLATFORMTHEME=gtk2” must be provided.

Original bug description:
Since I upgraded to Qt 5.7.1, Qt5 apps stopped picking up the Ubuntu (GTK+, I presume) theme, and look very Windowsy. I have qt5-gtk-platformtheme installed, and I tried forcing it by setting QT_QPA_PLATFORMTHEME, but to no avail.

Tags: bionic qt5 theme
Revision history for this message
Andrej Shadura (andrew.sh) wrote :
Revision history for this message
Dmitry Shachnev (mitya57) wrote :

Hi Andrew!

In Qt 5.7, the GTK+ support was restructured:

* qt5-gtk-platformtheme contains GTK+ 3 platform theme *only* (i.e. native dialogs and icon theme).
* qt5-style-plugins contains GTK+ 2 platform theme *and* style.

So if you want the old GTK+ style, then the correct solution is install qt5-style-plugins and export QT_QPA_PLATFORMTHEME=gtk2.

Changed in qtbase-opensource-src (Ubuntu):
status: New → Invalid
Revision history for this message
Andrej Shadura (andrew.sh) wrote :

I know, I tried that, it doesn't work.

Changed in qtbase-opensource-src (Ubuntu):
status: Invalid → New
Revision history for this message
Andrej Shadura (andrew.sh) wrote :

Let me illustrate that.

Revision history for this message
Dmitry Shachnev (mitya57) wrote :

Can it be that you have QT_STYLE_OVERRIDE=gtk exported somewhere? I have just seen a user with that environment variable and similar symptoms, and removing that line helped.

There is no style named “gtk” in Qt 5 (only “gtk2”), so Qt (< 5.8) falls back to the first available style (most likely the “bb10dark” which looks ugly). This behavior was fixed in Qt 5.8 in http://code.qt.io/cgit/qt/qtbase.git/commit/?id=76746ddab6f.

Revision history for this message
Andrej Shadura (andrew.sh) wrote :

Yes, indeed, this variable is set to gtk, not gtk2, and I can't find what sets it, and my attempts to override it fail :/

Revision history for this message
Andrej Shadura (andrew.sh) wrote :

Of course, I can try to forcefully upgrade to 5.8, but I'd rather not do that unless absolutely necessary.

Revision history for this message
Andrej Shadura (andrew.sh) wrote :

I've just ran into this issue once again on a freshly installed Ubuntu. It exports QT_STYLE_OVERRIDE=gtk somewhere, and that makes e.g. Dropbox not work correctly.

Revision history for this message
Andrej Shadura (andrew.sh) wrote :

Oh, in fact it's the same with other Qt5 apps.

Revision history for this message
Andrej Shadura (andrew.sh) wrote :

Oh, I found it, in was in my ~ :D

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in qtbase-opensource-src (Ubuntu):
status: New → Confirmed
tags: added: bionic
Revision history for this message
Alexey Kulik (doctor-rover) wrote :

Installing qt5-style-plugins and export QT_QPA_PLATFORMTHEME=gtk2 works for me. Great! Thank you for the clue.
But I believe that this must be enabled by default and absence of this package in the default installation is actually the bug.

summary: - Qt5 apps don’t pick up the GTK+ style anymore
+ Include qt5-style-plugins into the default installation, otherwise Qt5
+ apps don’t pick up the GTK+ style
description: updated
Revision history for this message
Dmitry Shachnev (mitya57) wrote :

We cannot do this for two reasons:

1) QGtkStyle is abandoned and unsupported upstream.
2) The goal is to remove GTK+ 2 from the default installation (and later from Ubuntu archive).

Changed in qtbase-opensource-src (Ubuntu):
status: Confirmed → Won't Fix
Revision history for this message
Alexey Kulik (doctor-rover) wrote :

Dmitry, thank you for your response and explanation.

Revision history for this message
Daniel Schürmann (daschuer) wrote :

This workaround works for me:

sudo apt install qt5-style-plugins
echo "export QT_QPA_PLATFORMTHEME=gtk2" >> ~/.profile

Not fixing this bug in Ubuntu means that all QT5 Applications will looks 80s.
https://bugs.launchpad.net/mixxx/+bug/1789113

Effected Apps are qBittorrent VLC Virtualbox Mixxx ...

In the Mixxx project, we like to offer our user the best experience and polished view.
Hacking magic commands to the terminal should not be a part of that.
I think we can also not add that to our install scripts because of the different ubuntu flavours.

Do you have any ideas what can be the solution to fix this regression?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.