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. How to react to light/dark mode changes in macos?
Forum Updated to NodeBB v4.3 + New Features

How to react to light/dark mode changes in macos?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 5 Posters 1.6k 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.
  • L Offline
    L Offline
    lasmr
    wrote on 1 Jun 2019, 20:10 last edited by
    #1

    Hi,

    I have an app with highly customized UI and I need to know what mode is used in macos when the app starts and I need to listen to changes in the mode.

    But I can't find the rith Qt API to deal with this.

    Thanks.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 1 Jun 2019, 20:14 last edited by
      #2

      Hi,

      Because, AFAIK, there's currently nothing specific for that available. You should check the macOS API to see if there's an event or equivalent that you can catch.

      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
      • M Offline
        M Offline
        manuelschneid3r
        wrote on 2 Dec 2021, 23:11 last edited by
        #3

        Have you found a solution?

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mpergand
          wrote on 2 Dec 2021, 23:59 last edited by mpergand 12 Mar 2021, 00:01
          #4

          I think the only thing you can rely on is QPalette colors.

          for example the window background color:
          palette().color(QPalette::Window);
          returns:
          QColor(ARGB 1, 0.196078, 0.196078, 0.196078) for dark mode
          QColor(ARGB 1, 0.92549, 0.92549, 0.92549) for light mode

          1 Reply Last reply
          0
          • J Offline
            J Offline
            J.Hilk
            Moderators
            wrote on 3 Dec 2021, 06:54 last edited by
            #5

            a swift (hehe) google search resulted in this so topic

            https://stackoverflow.com/a/52406553/15422846

            its objective c, so you should be able to include it in your c++ project


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            1 Reply Last reply
            2

            • Login

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