Important: Please read the Qt Code of Conduct -

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:

    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.

  • Lifetime Qt Champion

    I think it was abandoned

    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.

  • Lifetime Qt Champion

    @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
    So I guess something else is wrong.

    The ldd output of this thread is still valid ?

    Also seems that Creator itself suffer from it

    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: =>  (0x00007fffe6d46000) => /home/user/Qt/Qt5.9.0/5.9/gcc_64/lib/ (0x00007f3117c9f000) => /home/user/Qt/Qt5.9.0/5.9/gcc_64/lib/ (0x00007f31174f2000) => /home/user/Qt/Qt5.9.0/5.9/gcc_64/lib/ (0x00007f3117160000) => /home/user/Qt/Qt5.9.0/5.9/gcc_64/lib/ (0x00007f3116a28000) => /usr/lib/x86_64-linux-gnu/ (0x00007f3116681000) => /lib/x86_64-linux-gnu/ (0x00007f311646a000) => /lib/x86_64-linux-gnu/ (0x00007f31160a1000) => /lib/x86_64-linux-gnu/ (0x00007f3115e84000) => /var/lib/VBoxGuestAdditions/lib/ (0x00007f3115c4b000) => /lib/x86_64-linux-gnu/ (0x00007f3115942000) => /lib/x86_64-linux-gnu/ (0x00007f3115728000) => /home/user/Qt/Qt5.9.0/5.9/gcc_64/lib/ (0x00007f311528e000) => /home/user/Qt/Qt5.9.0/5.9/gcc_64/lib/ (0x00007f3114ed6000) => /home/user/Qt/Qt5.9.0/5.9/gcc_64/lib/ (0x00007f31134f3000) => /lib/x86_64-linux-gnu/ (0x00007f31132ea000) => /lib/x86_64-linux-gnu/ (0x00007f31130e6000) => /usr/lib/x86_64-linux-gnu/ (0x00007f3112ee4000) => /lib/x86_64-linux-gnu/ (0x00007f3112bd2000)
    /lib64/ (0x000055a3ba2f4000) => /usr/lib/x86_64-linux-gnu/ (0x00007f31129ef000) => /usr/lib/x86_64-linux-gnu/ (0x00007f31127eb000) => /usr/lib/x86_64-linux-gnu/ (0x00007f31125e8000) => /usr/lib/x86_64-linux-gnu/ (0x00007f31123e2000) => /usr/lib/x86_64-linux-gnu/ (0x00007f31121cf000) => /lib/x86_64-linux-gnu/ (0x00007f3111f5f000) => /usr/lib/x86_64-linux-gnu/ (0x00007f3111c24000) => /usr/lib/x86_64-linux-gnu/ (0x00007f3111a02000) => /usr/lib/x86_64-linux-gnu/ (0x00007f31117fd000) => /usr/lib/x86_64-linux-gnu/ (0x00007f31115f7000)

Log in to reply