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. [SOLVED] Fusion style - how to set dark version?
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Fusion style - how to set dark version?

Scheduled Pinned Locked Moved General and Desktop
7 Posts 4 Posters 27.3k 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.
  • K Offline
    K Offline
    Kobid
    wrote on last edited by
    #1

    Hi,

    Referring to this article: http://blog.qt.digia.com/blog/2012/10/30/cleaning-up-styles-in-qt5-and-adding-fusion/ you find dark version of fusion style. Is it compiled in QT by default? I don't know how to set it.

    Regards

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      I assume Fusion honours Qt style sheets and/or QPalette to set the various colours.

      1 Reply Last reply
      0
      • J Offline
        J Offline
        Jens
        wrote on last edited by
        #3

        I answered a similar question in the comments section you link to actually. It does respect QPalette, so you can try setting these color roles on the QApplication palette:
        window/button: #353535
        highlight: #8e2dc5

        1 Reply Last reply
        0
        • K Offline
          K Offline
          Kobid
          wrote on last edited by JKSH
          #4

          Thanks! Working perfect. But can't find color name for tabsheet text. I have this:

              QApplication::setStyle(QStyleFactory::create("Fusion"));
              QPalette p;
              p = qApp->palette();
              p.setColor(QPalette::Window, QColor(53,53,53));
              p.setColor(QPalette::Button, QColor(53,53,53));
              p.setColor(QPalette::Highlight, QColor(142,45,197));
              p.setColor(QPalette::ButtonText, QColor(255,255,255));
              qApp->setPalette(p);
          

          All buttons have white font except tabsheet text where it is still black

          edit: please wrap code sections between @ signs; Andre

          1 Reply Last reply
          0
          • J Offline
            J Offline
            Jens
            wrote on last edited by
            #5

            I am not sure what you mean by tab sheet but you can also experiment with QPalette::WindowText and QPalette::Text roles. In some cases perhaps you also need to set a widget specific palette.

            1 Reply Last reply
            0
            • K Offline
              K Offline
              Kobid
              wrote on last edited by
              #6

              Problem solved. Override QPalette::WindowText was needed also. Thanks!

              1 Reply Last reply
              0
              • G Offline
                G Offline
                glevner
                wrote on last edited by
                #7

                This technique works, but I wouldn't say the result is "perfect". The Fusion style generates lots of colors automatically by calling QColor::lighter() and QColor::darker(), and those would need to be inverted for the result to be perfect. As a result, depending on the exact colors you use, the frames around menus and the separators between menu items, for example, tend to disappear...

                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