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. Using qgtk2 plugin with Qt 5.9?
Forum Updated to NodeBB v4.3 + New Features

Using qgtk2 plugin with Qt 5.9?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 1.9k Views 1 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

    Is it possible to use the qgtk2 plugin from Qt 5.6.2 with newer versions of Qt, such as Qt 5.9.1? If so how can this be achieved?

    Just to give some background on why I ask this; in Qt 5.8.0 the qgtk2 plugin, which emulates the system GTK2 theme on Linux, was replaced by a new qgtk3 plugin, which is supposed to emulate the system's GTK3 theme. Unfortunately the new plugin is not very robust and fails to correctly emulate the system GTK3 theme on many desktop environments, and particularly on Cinnamon. I've continued to use Qt 5.6.2 on Linux, since that was the last version that came with the qgtk2 plugin, and was therefore the last version that worked correctly on Linux. However, Qt 5.6.2 is getting quite old and issues are starting to arise, for example it no longer compiles correctly on the latest release of Arch Linux because Qt 5.6.2 requires openssl 1.0 and Arch now ships with openssl 1.1, which causes compilation errors. I'd therefore like to switch to Qt 5.9.1 on Linux, but continue to use the qgtk2 plugin from 5.6.2 so that the system GTK is correctly emulated.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What you can try is to copy the gtk2 plugin over to your 5.9.1 and modify the platformthemes.pro file to make it build the plugin.

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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

        I tried deleting the Qt5.9.0/qtbase/src/plugins/platformthemes/gtk3 folder and replacing it with the qgtk2 folder from Qt 5.6.2. I then modified the 5.9.0 platformthemes.pro to change gtk3 to gtk2:

        TEMPLATE = subdirs
        QT_FOR_CONFIG += widgets-private
        
        qtHaveModule(widgets):qtConfig(gtk2): SUBDIRS += gtk2
        

        After configuration it generated this makefile, but it failed to build:

        Makefile:670: recipe for target 'sub-plugins-make_first' failed
        make[2]: *** [sub-plugins-make_first] Error 2
        make[2]: Leaving directory '/home/user/Qt/Qt5.9.0-S64/qtbase/src'
        Makefile:49: recipe for target 'sub-src-make_first' failed
        make[1]: *** [sub-src-make_first] Error 2
        make[1]: Leaving directory '/home/user/Qt/Qt5.9.0-S64/qtbase'
        Makefile:83: recipe for target 'module-qtbase-make_first' failed
        make: *** [module-qtbase-make_first] Error 2
        

        I also tried using the platformthemes.pro from Qt 5.6.2:

        TEMPLATE = subdirs
        
        contains(QT_CONFIG, gtk2): SUBDIRS += gtk2
        

        While Qt did compile with that, the qgtk2 plugin wasn't actually built. I'm not sure how to get it working.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          No need to delete anything.

          You contains line won't work, there's no detection done for GTK2 anymore. Since you want to build it anyway, just keep the SUBDIRS part.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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

            I changed the platformthemes.pro to the below:

            TEMPLATE = subdirs
            
            SUBDIRS += gtk2
            

            However, it fails to build with the same errors as before:

            Makefile:670: recipe for target 'sub-plugins-make_first' failed
            make[2]: *** [sub-plugins-make_first] Error 2
            make[2]: Leaving directory '/home/user/Qt/Qt5.9.0-S64/qtbase/src'
            Makefile:49: recipe for target 'sub-src-make_first' failed
            make[1]: *** [sub-src-make_first] Error 2
            make[1]: Leaving directory '/home/user/Qt/Qt5.9.0-S64/qtbase'
            Makefile:83: recipe for target 'module-qtbase-make_first' failed
            make: *** [module-qtbase-make_first] Error 2
            

            I think the problem is actually in the qgtk2.pro file and is probably the below two lines. I assume QT_CFLAGS_QGTK2 and QT_LIBS_QGTK2 are no longer defined in Qt 5.9.0:

            QMAKE_CXXFLAGS += $$QT_CFLAGS_QGTK2
            LIBS += $$QT_LIBS_QGTK2
            

            I might have to give up on using qgtk2 with Qt 5.9.0.

            I'm thinking of reporting the qtk3 issues as a bug. I've been testing it with a variety of distributions and desktop environments and it does seem to have a lot of problems, and produces a number of different errors. I might write up a bug report with the errors and some screenshots of it failing to emulate the system GTK3 theme.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Take a look at the content of the equivalent GTK3 flags and adapt them for GTK2.

              Or just configure an older version of Qt with the GTK2 plugin and copy the values you can find.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1

              • Login

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