Results 1 to 3 of 3

Thread: How can I get System setting color

  1. #1
    Join Date
    Feb 2010
    Posts
    99
    Thanks
    31
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default How can I get System setting color

    Hi,

    I want to get the system color for widget background. How can I get that?
    Another example would be get the system color for button face.

    Thanks.

  2. #2
    Join Date
    Feb 2010
    Posts
    99
    Thanks
    31
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How can I get System setting color

    I found the solution

    Qt Code:
    1. QWidget tmpWidget;
    2. QColor backGroundColor=tmpWidget.palette().color(QPalette::Window);
    To copy to clipboard, switch view to plain text mode 

  3. The following user says thank you to dpatel for this useful post:

    AlekseyK (4th May 2016)

  4. #3
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    507
    Thanks
    11
    Thanked 76 Times in 74 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How can I get System setting color

    Hi, use QApplication::palette() and ask its color() method for the color you want.

    Ginsengelf

    edit: perfectly in sync... For the application's palette you would not need a temporary widget, so I think that's the better way.
    Last edited by Ginsengelf; 20th July 2010 at 08:22. Reason: updated contents

  5. The following 2 users say thank you to Ginsengelf for this useful post:

    AlekseyK (4th May 2016), dpatel (20th July 2010)

Similar Threads

  1. Saving color setting
    By waynew in forum Qt Programming
    Replies: 10
    Last Post: 13th January 2015, 13:15
  2. Replies: 3
    Last Post: 1st July 2010, 13:54
  3. Setting the system time make the Qt program blocked.
    By alps_xing in forum Qt Programming
    Replies: 0
    Last Post: 10th June 2010, 08:12
  4. setting text also changes color?
    By drhex in forum Qt Programming
    Replies: 5
    Last Post: 22nd November 2006, 16:36
  5. How to get system color in QT4 as in C#.NET
    By mitesh in forum Qt Programming
    Replies: 1
    Last Post: 19th September 2006, 07:03

Bookmarks

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.