Results 1 to 20 of 25

Thread: Window colour

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    Join Date
    Oct 2007
    Posts
    201
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    19
    Thanked 1 Time in 1 Post

    Unhappy Re: Window colour

    HI all.
    I ve changed the colour of window by usning the code

    Qt Code:
    1. QPalette p( this->palette());
    2. p.setColor( QPalette::Window, QColor(Qt::black));
    3. this->setPalette(p);
    To copy to clipboard, switch view to plain text mode 
    now i need to check the window colour. if it is black i need 2 change it to gray and vice versa. i Tried to do as below but its not working

    Qt Code:
    1. if(QMainWindow::backgroundRole() == Qt::black)
    2. {
    3. QPalette p( this->palette());
    4. p.setColor( QPalette::Window, QColor(Qt::gray));
    5. this->setPalette(p);
    6. }
    To copy to clipboard, switch view to plain text mode 
    But its not coming inside if loop.
    Can any body help me.
    thank you all.
    Last edited by jpn; 27th February 2008 at 09:11. Reason: missing [code] tags
    Cheers,
    Phillip



    --- Please post the solution you got to solve your problem. It may help others.

Similar Threads

  1. Set a window as child at runtime
    By sabeesh in forum Qt Programming
    Replies: 1
    Last Post: 26th November 2007, 09:30
  2. Change shape of window / animate window
    By sabeesh in forum Qt Programming
    Replies: 3
    Last Post: 31st October 2007, 08:16
  3. Replies: 1
    Last Post: 11th September 2007, 13:34
  4. move parent window to the front.
    By hvengel in forum Qt Programming
    Replies: 4
    Last Post: 2nd February 2007, 08:41
  5. background colour
    By kw in forum Qt Programming
    Replies: 6
    Last Post: 11th April 2006, 00:44

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
  •  
Qt is a trademark of The Qt Company.