Results 1 to 7 of 7

Thread: background colour

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    2

    Talking Re: background colour

    awesome

    Granted, it's a bit hackish indeed.. but when other options fail, it can work to just paint the square of (scrollbar_width, scrollbar_height) in that corner in the standard button colour.
    It'd look nicer anyway. I hope the trolltech people will change this actually, I would much prefer to have this corner have the same colour as the buttons (like the up/down/left/right arrows of the real scrollbars), I think this is the standard way of win and nix anyway (not sure about mac)..

    -kw

  2. #2
    Join Date
    Jan 2006
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    2

    Default Re: background colour

    For anyone interested, I found out there's an easier and much neater way to do this..
    After the:
    Qt Code:
    1. QPalette p( this->palette() );
    2.  
    3. p.setColor( QPalette::Window, QColor(128,50,50,255) );
    4.  
    5. this->setPalette( p );
    To copy to clipboard, switch view to plain text mode 

    Just call
    Qt Code:
    1. this->setBackgroundRole(QPalette::Window);
    To copy to clipboard, switch view to plain text mode 

    All of this code is from within the qscrollarea widget (subclass it, or change the code a bit so it doesn't use 'this' and do it from the outside)

    regards,
    kw

  3. #3
    Join Date
    Jan 2006
    Location
    Mountain View, CA
    Posts
    279
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanked 42 Times in 37 Posts

    Default Re: background colour

    Cool! I'll make a note of that.
    Save yourself some pain. Learn C++ before learning Qt.

Similar Threads

  1. QLCDNumber with transparent background?
    By PolyVox in forum Qt Programming
    Replies: 2
    Last Post: 20th October 2008, 06:34
  2. Replies: 5
    Last Post: 30th March 2008, 17:53
  3. Dynamically changing QLabel background colour
    By T4ng10r in forum Qt Programming
    Replies: 19
    Last Post: 19th April 2007, 13:47
  4. Replies: 3
    Last Post: 8th December 2006, 19:51
  5. Replies: 1
    Last Post: 5th April 2006, 17: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.