Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-90504

Dark theme not respected by Fusion style

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3: Somewhat important
    • 6.4.0 Beta4
    • 5.15.2
    • Widgets: Styles
    • None
    • Ubuntu 20.04 LTS
    • Linux/Other display system

    Description

      Hi.  I'm not sure whether I logged this bug on the right targets; I'm on Ubuntu 20.04 LTS, which I guess uses Gnome by default, but Linux/Gnome wasn't a choice so I picked "Linux/Other display system".  And I'm not sure "Widgets: Styles" is right either, sorry.

      Here's the problem.  I'm trying to get my Qt app to run with a "dark mode" theme.  First I tried using Gnome's "tweaks" app to simply change to a dark theme, and that worked for the system overall – but apparently Qt apps ignore that setting.  That's the fundamental problem that I intend this bug to apply to: Ubuntu is a very mainstream platform, and Gnome is the windowing system it uses out of the box, and it seems odd/surprising that Qt just ignores the user's theme setting in that environment (unless I'm doing something wrong, perhaps).

      After some head-scratching, I found this article: https://frontpagelinux.com/tutorials/qt-theming-on-ubuntu-and-other-gnome-desktops/.  It seems to confirm that Qt apps ignore the user's theme in Gnome, and it provides a workaround involving installing something called Kvantum that can provide a dark theme to Qt apps.  This sounded great, so I went through the steps described and got it installed.  Now, however, when I run my app, I get an error at startup:

      QApplication: invalid style override 'kvantum' passed, ignoring it.
      Available styles: Windows, Fusion

      I have no idea why this happens; I think I followed the steps correctly.  So I'm pretty much at my wit's end.  I just want to do this in order to test that my app's "dark mode" support (which I just added for macOS, and it works great on that platform) also works properly on Linux.  But if I can't figure out how to get my app to run with a dark theme on Linux, then I'm unable to test this feature.  :-<  So, if you know how to get my app to run with a dark theme on Ubuntu 20.04, I'd appreciate that info; but in any case, after beating my head against the wall for half a day on this, it seems to me that Qt needs better support for the user's chosen theme on this platform.  Thanks!

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-90504
          # Subject Branch Project Status CR V

          Activity

            People

              mitch_curtis Mitch Curtis
              bhaller Ben Haller
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes