Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. GTK Style Not Working On Qt5.7+?
Qt 6.11 is out! See what's new in the release blog

GTK Style Not Working On Qt5.7+?

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 4 Posters 5.9k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Elsworth55
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • V Offline
      V Offline
      Vadi2
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

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

        Maybe its just old info :)

        1 Reply Last reply
        0
        • E Offline
          E Offline
          Elsworth55
          wrote on last edited by
          #4

          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.

          mrjjM 1 Reply Last reply
          0
          • E Elsworth55

            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.

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by mrjj
            #5

            @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.

            1 Reply Last reply
            1
            • E Offline
              E Offline
              Elsworth55
              wrote on last edited by
              #6

              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)
              
              1 Reply Last reply
              1
              • Y Offline
                Y Offline
                yash_raj_33
                wrote last edited by
                #7

                So I came here while researching for the problems with qt5 theme. So in the archi wiki it says -

                QGtk3Style
                This is a platform theme built into qt5-base starting with version 5.7.0 [2] and qt6-base. It can be used to style Qt5 and Qt6 applications according to current GTK3 style. It can be enabled by setting the following environment variable: QT_QPA_PLATFORMTHEME=gtk3. 
                

                I am on nixos and while if i set the same envionment variable qt6 apps like pcmanfm-qt, qbittorrent correctly use the same colors as my gtk3 theme, but it seems qt5 apps even though in logs they seem to load the plugin, dont theme accordingly and show the default white color. Its an old thread so I just want to know is the plugin abandoned? Meaning its no use trying to wait for it to update and be fixed or should i just switch to qtstyleplugins for qt5 apps?

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved