FedoraQt/QGnomePlatform

The platform theme is not automatically loaded after Qt6 is updated to 6.4.1

struq opened this issue · 10 comments

struq commented

In Fedora 37 Gnome Wayland environment, after an update of Qt6 from version 6.3.1-4.fc37 to 6.4.1-1.fc37 and QGnomePlatform from 0.9.0-2.fc37 to 0.9.0-5.fc37, the Gnome theme is not automatically applied any more to Qt6 applications such as Wireshark and Fedora Media Writer. The window frame is now a simple white frame with black symbols for the buttons instead of the Gnome style. Downgrading to the old versions brings back the expected behavior. Manually setting QT_QPA_PLATFORMTHEME='gnome' also works.

It works here. Can you make sure you have qgnomeplatform-qt6 installed?

struq commented

Can you make sure you have qgnomeplatform-qt6 installed?

Yes, version 0.9.0-5.fc37. I think that's why setting the environment variable still works.

I can reproduce the issue with a vm running Fedora 37 live image too, with the updated qt6 packages.

6 3 1
6 4 1
6 4 1_envvar

Can you run following and attach here the output when plugins are loaded:
QT_LOGGING_RULES='*=true' QT_DEBUG_PLUGINS=1 wireshark

Should look like this:

 ** (wireshark:94731) 13:10:30.207347 [GUI WARNING] -- Adding platform integration's theme names to list of theme names: QList("gtk3", "gnome", "generic")
 ** (wireshark:94731) 13:10:30.207354 [GUI WARNING] -- Attempting to create platform theme "gtk3" via QPlatformThemeFactory::create
 ** (wireshark:94731) 13:10:30.207367 [GUI WARNING] -- checking directory path "/usr/lib64/qt6/plugins/platformthemes" ...
 ** (wireshark:94731) 13:10:30.207418 [GUI WARNING] -- looking at "/usr/lib64/qt6/plugins/platformthemes/libqgnomeplatformtheme.so"
 ** (wireshark:94731) 13:10:30.207475 [GUI WARNING] -- Found metadata in lib /usr/lib64/qt6/plugins/platformthemes/libqgnomeplatformtheme.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformThemeFactoryInterface.5.1",
    "MetaData": {
        "Keys": [
            "gnome",
            "gtk3",
            "qgnomeplatform"
        ]
    },
    "archlevel": 1,
    "className": "QGnomePlatformThemePlugin",
    "debug": false,
    "version": 394240
}


 ** (wireshark:94731) 13:10:30.207496 [GUI WARNING] -- Got keys from plugin meta data QList("gnome", "gtk3", "qgnomeplatform")
 ** (wireshark:94731) 13:10:30.207508 [GUI WARNING] -- looking at "/usr/lib64/qt6/plugins/platformthemes/libqgtk3.so"
 ** (wireshark:94731) 13:10:30.207561 [GUI WARNING] -- Found metadata in lib /usr/lib64/qt6/plugins/platformthemes/libqgtk3.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformThemeFactoryInterface.5.1",
    "MetaData": {
        "Keys": [
            "gtk3"
        ]
    },
    "archlevel": 1,
    "className": "QGtk3ThemePlugin",
    "debug": false,
    "version": 394240
}


 ** (wireshark:94731) 13:10:30.207579 [GUI WARNING] -- Got keys from plugin meta data QList("gtk3")
 ** (wireshark:94731) 13:10:30.207591 [GUI WARNING] -- looking at "/usr/lib64/qt6/plugins/platformthemes/libqxdgdesktopportal.so"
 ** (wireshark:94731) 13:10:30.207637 [GUI WARNING] -- Found metadata in lib /usr/lib64/qt6/plugins/platformthemes/libqxdgdesktopportal.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformThemeFactoryInterface.5.1",
    "MetaData": {
        "Keys": [
            "xdgdesktopportal",
            "flatpak",
            "snap"
        ]
    },
    "archlevel": 1,
    "className": "QXdgDesktopPortalThemePlugin",
    "debug": false,
    "version": 394240
}


 ** (wireshark:94731) 13:10:30.207653 [GUI WARNING] -- Got keys from plugin meta data QList("xdgdesktopportal", "flatpak", "snap")
 ** (wireshark:94731) 13:10:30.207660 [GUI WARNING] -- checking directory path "/usr/bin/platformthemes" ...
 ** (wireshark:94731) 13:10:30.219168 [GUI WARNING] -- "/usr/lib64/qt6/plugins/platformthemes/libqgnomeplatformtheme.so" loaded library
 ** (wireshark:94731) 13:10:30.219216 [GUI WARNING] -- Successfully created platform theme "gtk3"

I can see wha't s wrong.

Each platform plugin (in this case Wayland) gives us list (keys) to load a platform theme on given desktop. In this case we get gtk3 as a key. This is used to load a platform theme that announces it uses this key. Qt provides their own gtk3 platform theme and it is installed together with QGnomePlatform. We always relied on being picked first, because libqgnomeplatformtheme.so is before libqgtk3.so so whatever platform theme was found first, it was used and it always worked without any issue and still works even for me. It apparently doesn't work now for you.

What's your output from ls /usr/lib64/qt6/plugins/platformthemes/?

struq commented
$ ls /usr/lib64/qt6/plugins/platformthemes/
libqgnomeplatformtheme.so  libqgtk3.so  libqxdgdesktopportal.so
$ ls /usr/lib64/qt6/plugins/platformthemes/
libqgnomeplatformtheme.so  libqgtk3.so  libqxdgdesktopportal.so

Looks good. There must have been a change in qtbase that changes this behavior. I will look and get back to you.

I have the same problem and it was probably introduced by this commit:
https://code.qt.io/cgit/qt/qtbase.git/commit/src/corelib/plugin/qfactoryloader.cpp?id=d5cac0b19bb2a94acae190709783cd5077c3de60

There is no guarantee that QDirIterator will iterate over files in alphabetical order.

I'm afraid we won't be able to fix this from our side. Your only option is to force QGnomePlatform to be used by QT_QPA_PLATFORMTHEME in your BASH evironment.

I can see you are using Fedora. I at least workarounded it there with https://src.fedoraproject.org/rpms/qt6-qtbase/blob/rawhide/f/qtbase-use-qgnomeplatform-as-default-platform-theme-on-gnome.patch. But this is a distro specific change, everybody else will need to use the env variable.