GTK Style Not Working On Qt5.7+?



  • Qt version 5.6.2 and earlier came with the qgtk2 plugin that would correctly style applications with your system's GTK2 theme. Qt 5.7.0 came with no GTK plugin, so applications appeared unstyled. Qt 5.8.0 and 5.9.0 both include the new qgtk3 plugin, but it doesn't appear to work, so applications still don't use your system's GTK3 theme.

    If you print out the available styles with:

    qDebug() << QStyleFactory::keys();
    

    Qt 5.6.2 lists: ("Windows", "GTK+", "Fusion")
    Qt 5.9.0 lists: ("Windows", "Fusion")

    Furthermore, when you run a Qt 5.9.0 application on Linux you always get the message:

    QApplication: invalid style override passed, ignoring it.
    

    I've been searching around for information on this, but can't find a lot. The most interesting discussion I found is here:

    https://github.com/therecipe/qt/issues/306

    He says that there are problems with the qgtk3 plugin on a variety of Linux distributions.

    Is there any way to get the qgtk3 plugin working?

    If not, would it be best to stick with Qt 5.6.2 for a couple of years while the problems are resolved?



  • I'm interested in this as well - one of the main reasons I use Qt is to get native-ish look'n'feel on all platforms, including my main one.


  • Qt Champions 2016

    Hi
    I think it was abandoned
    https://codereview.qt-project.org/#/c/75757/

    Maybe its just old info :)



  • I think that must be a different GTK3 plugin. It's listed as abandoned on 18th June 2016, yet the qgtk3 plugin was first included with Qt 5.8.0 which was released on 23rd January 2017, and is also included with the recently released 5.9.0.

    I don't think they'd include it if the plugin had been abandoned. Plus, I don't think they could abandon GTK theme emulation entirely since it's essential to make Qt applications look native on Linux.


  • Qt Champions 2016

    @Elsworth55 said in GTK Style Not Working On Qt5.7+?:

    qgtk3 plugin

    I think you are right.
    Also i have this file in 5.7
    "C:\Qt\5.7\Src\qtbase\src\plugins\platformthemes\gtk3\qgtk3theme.cpp"
    So I guess something else is wrong.

    The ldd output of this thread is still valid ?
    https://forum.qt.io/topic/75398/qt-5-8-0-qapplication-invalid-style-override-passed-ignoring-it/9

    Also seems that Creator itself suffer from it
    https://bugreports.qt.io/browse/QTBUG-53844

    So not sure if its fixed and just bugged on some distros or not fixed
    at all.



  • Yes, Qt Creator has had that issue since 5.7. The last version of Qt Creator that correctly used the GTK theme is the one that came with 5.6.2. I think it might be best to stick with 5.6.2 for now, and I'll give the next Qt release a try when it comes out.

    As for the ldd output, for some reason I'm getting a significantly different ouptut from when I tried with 5.8. I might have run it with a different application last time or maybe I ran it on a debug build. This is what I got running it just now with 5.9:

    linux-vdso.so.1 =>  (0x00007fffe6d46000)
    libQt5Widgets.so.5 => /home/user/Qt/Qt5.9.0/5.9/gcc_64/lib/libQt5Widgets.so.5 (0x00007f3117c9f000)
    libQt5Gui.so.5 => /home/user/Qt/Qt5.9.0/5.9/gcc_64/lib/libQt5Gui.so.5 (0x00007f31174f2000)
    libQt5Network.so.5 => /home/user/Qt/Qt5.9.0/5.9/gcc_64/lib/libQt5Network.so.5 (0x00007f3117160000)
    libQt5Core.so.5 => /home/user/Qt/Qt5.9.0/5.9/gcc_64/lib/libQt5Core.so.5 (0x00007f3116a28000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f3116681000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f311646a000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f31160a1000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f3115e84000)
    libGL.so.1 => /var/lib/VBoxGuestAdditions/lib/libGL.so.1 (0x00007f3115c4b000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f3115942000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f3115728000)
    libicui18n.so.56 => /home/user/Qt/Qt5.9.0/5.9/gcc_64/lib/libicui18n.so.56 (0x00007f311528e000)
    libicuuc.so.56 => /home/user/Qt/Qt5.9.0/5.9/gcc_64/lib/libicuuc.so.56 (0x00007f3114ed6000)
    libicudata.so.56 => /home/user/Qt/Qt5.9.0/5.9/gcc_64/lib/libicudata.so.56 (0x00007f31134f3000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f31132ea000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f31130e6000)
    libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007f3112ee4000)
    libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f3112bd2000)
    /lib64/ld-linux-x86-64.so.2 (0x000055a3ba2f4000)
    VBoxOGLcrutil.so => /usr/lib/x86_64-linux-gnu/VBoxOGLcrutil.so (0x00007f31129ef000)
    libXcomposite.so.1 => /usr/lib/x86_64-linux-gnu/libXcomposite.so.1 (0x00007f31127eb000)
    libXdamage.so.1 => /usr/lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007f31125e8000)
    libXfixes.so.3 => /usr/lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007f31123e2000)
    libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f31121cf000)
    libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f3111f5f000)
    libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f3111c24000)
    libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f3111a02000)
    libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f31117fd000)
    libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f31115f7000)
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.