Results 1 to 3 of 3

Thread: How to set a "dark color theme" for all widgets within the application ?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2015
    Qt products
    Qt5 Qt/Embedded
    Unix/X11 Windows Android

    Default How to set a "dark color theme" for all widgets within the application ?


    my application is displayed currently in the standard grey color scheme. I would like to display my MainWindow and all its children and sub dialogs in a dark color theme... like:

    I currently use a Windows machine, but this setting should work on all OS. Is there a way for this?

    Thanks in advance. Ralf

  2. #2
    Join Date
    Feb 2012
    Warsaw, Poland
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4 Qt5
    Unix/X11 Windows Android

    Default Re: How to set a "dark color theme" for all widgets within the application ?

  3. #3
    Join Date
    Oct 2013
    Qt products
    Qt4 Qt5
    Unix/X11 Windows

    Wink Re: How to set a "dark color theme" for all widgets within the application ?

    poke, poke...

    Quote Originally Posted by west View Post
    Just a quick note on any survivors that made it this far (and want to get dark, quickly):
    You do not have to do all that if you want just the background and foreground colors reversed (and * is not a good idea if you want to change attributes like 'border' which forces stuff that didn't have a border before to now have one). It's best to just put a style on QWidget and use 'border-color', that way if there is no border, you are not adding one in a place where it would look weird, like around every label for example. Also, programmers often do not measure a border or any other attribute that wasn't supposed to be there in the first place, when placing their widgets programmatically, though that is actually a no-no because you have to assume someone might use the -stylesheet command unless you block it explicitly when QApplication is getting underway, but that's a trickery subject for another time! Now, remember to always delegate whatever you can, whenever you can. It will save you time in the long run!
    You should put in a style like '-style 'fusion' and then specify a minimal dark/light theme that modifies QWidget, since most widgets that you'll want to change derive from it. Also don't modify 'background', but rather 'background-color' for the same reasons as border, unless you don't want the program to show any background images at all. At this point your should have very few classes to go back and "fix" (like making the cursor transparent, for one). This works in Linux, Windows, Mac, whatever, because of the "platforminess" of the Qt framework. Last thing, you might want to restrict changes from going into QWebANYTHING because that is a mess you don't want, believe me. Well, have fun!

Similar Threads

  1. Replies: 3
    Last Post: 16th March 2015, 07:31
  2. Replies: 2
    Last Post: 20th September 2013, 22:47
  3. Replies: 5
    Last Post: 29th September 2012, 19:30
  4. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05
  5. border color is wrong with "plastique" style in Qt4.2.3
    By alfa_wu in forum Qt Programming
    Replies: 2
    Last Post: 30th April 2007, 04:27

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.