Results 1 to 3 of 3

Thread: how to change the color of a top widget ?

  1. #1
    Join Date
    Dec 2009
    Posts
    2
    Thanks
    1
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Lightbulb how to change the color of a top widget ?

    hello
    I'm new to QT.I wrote a QT ui.the top is a widget,an some buttons in it.
    And, I want to change the color of the ui, including the top widget.
    what can I do ??
    Thank you .

  2. #2
    Join Date
    Jan 2006
    Location
    Boston, MA
    Posts
    40
    Thanks
    1
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: how to change the color of a top widget ?

    Thru palette for your widget.

    In sources it may look like this:
    Qt Code:
    1. QPalette palette = this->palette();
    2. palette.setColor(QPalette::Window, QColor::fromRgb(255, 0, 0, 255));
    3. this->setPalette(palette);
    To copy to clipboard, switch view to plain text mode 

    take a look on http://doc.qt.nokia.com/4.6/qpalette.html

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

    feiyinziiu (4th December 2009)

  4. #3
    Join Date
    Dec 2009
    Posts
    2
    Thanks
    1
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: how to change the color of a top widget ?

    Quote Originally Posted by feiyinziiu View Post
    hello
    I'm new to QT.I wrote a QT ui.the top is a widget,an some buttons in it.
    And, I want to change the color of the ui, including the top widget.
    what can I do ??
    Thank you .
    Thank you.

Similar Threads

  1. QDockWidget inside another widget in the center?
    By Antebios in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2010, 07:06
  2. Change widget type
    By drescherjm in forum Qt Tools
    Replies: 2
    Last Post: 16th April 2009, 02:03
  3. Hide widget, but not change layout
    By dimaz in forum Qt Programming
    Replies: 3
    Last Post: 21st November 2008, 14:32
  4. Replies: 1
    Last Post: 4th November 2008, 22:47
  5. How can I change widget images and layouts?
    By sendyou in forum Qt Programming
    Replies: 1
    Last Post: 20th August 2008, 11:07

Tags for this Thread

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.