Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Getting Qt application to honour dark theme on Lubuntu 26.04.1
Qt 6.12 LTS is out! See what's new in the release blog

Getting Qt application to honour dark theme on Lubuntu 26.04.1

Scheduled Pinned Locked Moved Unsolved General and Desktop
31 Posts 7 Posters 1.8k Views 4 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.
  • PerdrixP Offline
    PerdrixP Offline
    Perdrix
    wrote last edited by Perdrix
    #19

    Hmmm some digging shows that the lxqt-qtplugin is shipped with the system as:
    /usr/lib/x86_64-linux-gnu/qt6/plugins/platformthemes/libqtlxqt.so

    But my install takes the theme plugins from /opt/DeepSkyStacker/plugins/platforms/platformthemes which contains plugins that were copied from /opt/Qt/6.10.0/gcc_64/plugins/platformthemes on my build system which doesn't include the lxqt plugin.

    As lxqt does ship a suitable plugin, how can this be included as part of the Qt6 distribution for Linux (not the one that comes with the system as I have no control over the level of that!).

    Looks like the QT distribution should also add a plugins/styles containing at least the Breeze and Kvantum plugins as shown here from the startup of an lxqt aware qt app (the desktop) on the system:

    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]: qt.core.plugin.factoryloader: checking directory path "/usr/lib/x86_64-linux-gnu/qt6/plugins/styles" ...
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]: qt.core.plugin.factoryloader: looking at "breeze6.so"
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]: qt.core.plugin.loader: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/styles/breeze6.so, metadata=
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]: {
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]:     "IID": "org.qt-project.Qt.QStyleFactoryInterface",
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]:     "MetaData": {
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]:         "Keys": [
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]:             "Breeze"
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]:         ]
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]:     },
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]:     "archlevel": 1,
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]:     "className": "StylePlugin",
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]:     "debug": false,
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]:     "version": 395776
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]: }
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]: qt.core.plugin.factoryloader: Got keys from plugin meta data QList("breeze")
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]: qt.core.plugin.factoryloader: looking at "libkvantum.so"
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]: qt.core.plugin.loader: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/styles/libkvantum.so, metadata=
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]: {
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]:     "IID": "org.qt-project.Qt.QStyleFactoryInterface",
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]:     "MetaData": {
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]:         "Keys": [
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]:             "kvantum",
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]:             "kvantum-dark"
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]:         ]
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]:     },
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]:     "archlevel": 1,
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]:     "className": "KvantumPlugin",
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]:     "debug": false,
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]:     "version": 395520
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]: }
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]: qt.core.plugin.factoryloader: Got keys from plugin meta data QList("kvantum", "kvantum-dark")
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]: qt.core.plugin.factoryloader: checking directory path "/usr/libexec/styles" ...
    Oct 30 09:10:05 charon org.freedesktop.impl.portal.desktop.lxqt[368070]: xdp-lxqt: Desktop portal registered successfully
    

    Thanks, David

    1 Reply Last reply
    0
    • PerdrixP Perdrix has marked this topic as unsolved
    • PerdrixP Offline
      PerdrixP Offline
      Perdrix
      wrote last edited by Perdrix
      #20

      @Axel-Spoerl https://qt-project.atlassian.net/browse/QTBUG-151943

      1 Reply Last reply
      0
      • PerdrixP Offline
        PerdrixP Offline
        Perdrix
        wrote last edited by
        #21

        Hmmm. I tried copying the system version of the plugin to my plugins/platformthemes directory and Qt didn't try to load it.

        I then tried export QT_QPA_PLATFORMTHEME=lxqt and got:

        qt.core.plugin.factoryloader: looking at "libqtlxqt.so"
        qt.core.plugin.loader: Found metadata in lib /opt/DeepSkyStacker/plugins/platformthemes/libqtlxqt.so, metadata=
        {
            "IID": "org.qt-project.Qt.QPA.QPlatformThemeFactoryInterface.5.1",
            "MetaData": {
                "Keys": [
                    "lxqt"
                ]
            },
            "archlevel": 1,
            "className": "LXQtPlatformThemePlugin",
            "debug": false,
            "version": 395776
        }
        
        
        qt.core.plugin.factoryloader: Got keys from plugin meta data QList("lxqt")
        qt.core.plugin.factoryloader: checking directory path "/opt/DeepSkyStacker/platformthemes" ...
        qt.core.library: "/opt/DeepSkyStacker/plugins/platformthemes/libqtlxqt.so" cannot load: Cannot load library /opt/DeepSkyStacker/plugins/platformthemes/libqtlxqt.so: /usr/lib/x86_64-linux-gnu/libQt6Svg.so.6: undefined symbol: _ZN14QObjectPrivateC2E16QtPrivate_6_10_2, version Qt_6_PRIVATE_API
        qt.core.plugin.loader: QLibraryPrivate::loadPlugin failed on "/opt/DeepSkyStacker/plugins/platformthemes/libqtlxqt.so" : "Cannot load library /opt/DeepSkyStacker/plugins/platformthemes/libqtlxqt.so: /usr/lib/x86_64-linux-gnu/libQt6Svg.so.6: undefined symbol: _ZN14QObjectPrivateC2E16QtPrivate_6_10_2, version Qt_6_PRIVATE_API"
        

        so this is definitely above my salary level :(

        David

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

          Hi,

          You need to build that plug-in with the Qt version you use to build your application. What happens is that you have Qt 6.10.0 loaded in memory for your application but that plug-in was built for 6.10.2.

          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
          • PerdrixP Offline
            PerdrixP Offline
            Perdrix
            wrote last edited by Perdrix
            #23

            @SGaist That makes sense, but OTOH I'd much prefer that Qt delivered it as part of the Qt distro ... and automatically searched for it. Hence the problem report I opened.

            D.

            SGaistS 1 Reply Last reply
            0
            • PerdrixP Perdrix

              @SGaist That makes sense, but OTOH I'd much prefer that Qt delivered it as part of the Qt distro ... and automatically searched for it. Hence the problem report I opened.

              D.

              SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote last edited by
              #24

              @Perdrix The thing is: that plugin is not part of Qt hence cannot be distributed with it.

              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
              0
              • PerdrixP Offline
                PerdrixP Offline
                Perdrix
                wrote last edited by Perdrix
                #25

                So you are saying that the plugin for e.g. kde is part of Qt, and that you think it’s viable for me to tell my users to do their own build of the plugins, or that you think that I should build and ship them with my product??

                The only way that makes sense to me is for Qt to ship them.

                As things stand, the theme support just doesn’t work for any Lubuntu users.

                Christian EhrlicherC JKSHJ 2 Replies Last reply
                0
                • PerdrixP Perdrix

                  So you are saying that the plugin for e.g. kde is part of Qt, and that you think it’s viable for me to tell my users to do their own build of the plugins, or that you think that I should build and ship them with my product??

                  The only way that makes sense to me is for Qt to ship them.

                  As things stand, the theme support just doesn’t work for any Lubuntu users.

                  Christian EhrlicherC Offline
                  Christian EhrlicherC Offline
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote last edited by
                  #26

                  @Perdrix said in Getting Qt application to honour dark theme on Lubuntu 26.04.1:

                  The only way that makes sense to me is for Qt to ship them.

                  Again: it's a third party plugin. How can Qt ship this at all? Ask your distribution to ship it as this is the right place.

                  Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                  Visit the Qt Academy at https://academy.qt.io/catalog

                  1 Reply Last reply
                  0
                  • PerdrixP Offline
                    PerdrixP Offline
                    Perdrix
                    wrote last edited by
                    #27

                    The distro cannot ship it as it has to be built with the exact level of Qt that is used to build and package my application. It needs a different build of the plugin for every Qt release.

                    1 Reply Last reply
                    0
                    • PerdrixP Perdrix

                      So you are saying that the plugin for e.g. kde is part of Qt, and that you think it’s viable for me to tell my users to do their own build of the plugins, or that you think that I should build and ship them with my product??

                      The only way that makes sense to me is for Qt to ship them.

                      As things stand, the theme support just doesn’t work for any Lubuntu users.

                      JKSHJ Offline
                      JKSHJ Offline
                      JKSH
                      Moderators
                      wrote last edited by
                      #28

                      @Perdrix said in Getting Qt application to honour dark theme on Lubuntu 26.04.1:

                      I should build and ship them with my product??

                      It looks like you already ship a copy of Qt and its official plugins. So, it makes sense to ship a copy of the 3rd-party plugin of interest too, right? @IgKh already found the source code for you in an earlier post, which contains compilation instructions.: https://github.com/lxqt/lxqt-qtplugin

                      Alternatively, you could make your application depend on the distro's copy of Qt instead of your own copy. That way, the app can also load the distro's copy of libqtlxqt.so

                      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                      1 Reply Last reply
                      0
                      • PerdrixP Offline
                        PerdrixP Offline
                        Perdrix
                        wrote last edited by Perdrix
                        #29

                        Alternatively, you could make your application depend on the distro's copy of Qt

                        That wouldn't work on most Linux distros, and the installed Qt would need to exactly match the verison of Qt I built my application with.

                        JKSHJ 1 Reply Last reply
                        0
                        • PerdrixP Perdrix

                          Alternatively, you could make your application depend on the distro's copy of Qt

                          That wouldn't work on most Linux distros, and the installed Qt would need to exactly match the verison of Qt I built my application with.

                          JKSHJ Offline
                          JKSHJ Offline
                          JKSH
                          Moderators
                          wrote last edited by
                          #30

                          @Perdrix said in Getting Qt application to honour dark theme on Lubuntu 26.04.1:

                          That wouldn't work on most Linux distros, and the installed Qt would need to exactly match the verison of Qt I built my application with.

                          An exact match is not needed. Qt promises compatibility: If you build your application with an older version of Qt 6, then users can run it with a newer version of Qt 6.

                          There have been times when compatibility was accidentally broken. When this happens, it is treated as a critical bug and all effort will be made to restore compatibility (example: https://qt-project.atlassian.net/browse/QTBUG-135578 )

                          Anyway, building and shipping libqtlxqt.so remains a valid solution.

                          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                          1 Reply Last reply
                          2
                          • S Offline
                            S Offline
                            SimonSchroeder
                            wrote last edited by
                            #31

                            A different post I replied to surfaced a different idea: On Linux we are distributing our app as AppImage. This will package all dependencies into an executable image. It is not the ideal solution for Linux, but if you have a small software that is not included in official repositories of the distros it is the much better option for maintainability. This would package both Qt and libqtlxqt alongside your app. It also does not require any special installation. Though, once you go down that path it is quite easy to register your app through xdg.

                            Here is roughly how we deploy our AppImage:

                            #!/bin/bash
                            
                            LD_LIBRARY_PATH= # additional library paths if required
                            export LD_LIBRARY_PATH
                            
                            chmod u+x linuxdeploy*.AppImage # on CI/CD this might not have the executable flag when checked out
                            export VERSION=1.0.0
                            
                            echo == Remove old AppDir. ==
                            rm -rf AppDir
                            
                            echo == Generate new AppDir. ==
                            ./linuxdeploy-x86_64.AppImage --appdir=AppDir --executable=../release/MyApp --desktop-file=MyApp.desktop --icon-file=MyApp.svg
                            
                            echo == Bundle Qt libs and create AppImage. ==
                            cd AppDir
                            ../linuxdeployqt-6-x86_64.AppImage MyApp.desktop -qmake=/path/to/qmake -appimage
                            
                            echo == Done. ==
                            

                            You'll see that we use both linuxdeploy and linuxdeployqt. This is at least what worked for us. These tools require you not to use the newest version of Linux because they want to ensure broad portability.

                            I guess that LGPL conformance is given because the AppImage is just a regular image that can be mounted regularly and thus someone might be able to exchange the libraries inside it.

                            Just for completeness sake: Besides AppImage there is also Snap and Flatpack. My research at the time brought me to AppImages.

                            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
                            • Unsolved