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. Detect dark/light mode changes to call update()
Forum Update on Monday, May 27th 2025

Detect dark/light mode changes to call update()

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 1.7k Views
  • 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.
  • B Offline
    B Offline
    buhtz
    wrote on last edited by
    #1

    It seems that PyQt do not react by itself when the user modfies the desktops theme from a ligth to a dark one.

    I need to catch that event to re-draw (via update()?) the whole GUI to fit to the new selected theme. But I don't get it how to do it.

    JonBJ 1 Reply Last reply
    0
    • B buhtz

      It seems that PyQt do not react by itself when the user modfies the desktops theme from a ligth to a dark one.

      I need to catch that event to re-draw (via update()?) the whole GUI to fit to the new selected theme. But I don't get it how to do it.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @buhtz
      Have you read through the suggestions at, say, https://stackoverflow.com/questions/75457687/detect-dark-application-style-theme-of-currently-used-desktop-in-qt ?Special handling if you are Qt 6.5+. Still may depend on your platform.

      For detecting the theme change event event, I am catching QEvent::ThemeChange in the main window's changeEvent() handler.

      ?

      B 1 Reply Last reply
      0
      • JonBJ JonB

        @buhtz
        Have you read through the suggestions at, say, https://stackoverflow.com/questions/75457687/detect-dark-application-style-theme-of-currently-used-desktop-in-qt ?Special handling if you are Qt 6.5+. Still may depend on your platform.

        For detecting the theme change event event, I am catching QEvent::ThemeChange in the main window's changeEvent() handler.

        ?

        B Offline
        B Offline
        buhtz
        wrote on last edited by
        #3

        Thanks. OK, there doesn't seem to be an easy way.
        So I don't work on it and will suggest my users just to restart the application.
        It is IMHO a rare case that users change the desktops color mode when the application is running. And even if it is the case most of them won't be bothered.

        JonBJ 1 Reply Last reply
        0
        • B buhtz

          Thanks. OK, there doesn't seem to be an easy way.
          So I don't work on it and will suggest my users just to restart the application.
          It is IMHO a rare case that users change the desktops color mode when the application is running. And even if it is the case most of them won't be bothered.

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @buhtz
          Well it's only a changeEvent() on (subclassed) QMainWindow, not much. But agree it's not vital.

          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