Results 1 to 7 of 7

Thread: background colour

Threaded View

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

    Question background colour

    Hi,

    I have a QImage inside a QScrollArea in my QMainWindow.
    Now that the classes have been mentioned, let me tell you the actual story. I'm custom drawing something that I want to display in a window. I'm using a QImage for this, because I will need pixel level access. I've put this QImage inside a scroll area so that if the picture Im drawing is larger than the window (or even the screen), the whole thing can still be viewed by scrolling. This works.
    The problem is that when you resize the window to be *larger* than the image I'm drawing, it fills everything outside my QImage with the standard grey background.
    After some messing around figuring out what background I was actually seeing, I ended up setting a new background colour for my QMainWindow, as follows:
    Qt Code:
    1. QPalette p( this->palette() );
    2. p.setColor( QPalette::Window, QColor(128,50,50,255) );
    3. this->setPalette( p );
    To copy to clipboard, switch view to plain text mode 

    This works.. in a way.. The problem is that it's not just using this colour as the background for the window, but also as the status bar colour, the scrollbars are tinted with it, and the corner of the scrollbars is filled with the colour. All in all, not a very nice look.
    Is there any way I can paint *just* the background of my window?

    Thanks for any pointers you can give me..
    I've attached a screenshot with clearly distinguishable colours. Black is the QImage and blue the window background.

    Regards,
    kw
    Attached Images Attached Images

Similar Threads

  1. QLCDNumber with transparent background?
    By PolyVox in forum Qt Programming
    Replies: 2
    Last Post: 20th October 2008, 05:34
  2. Replies: 5
    Last Post: 30th March 2008, 16:53
  3. Dynamically changing QLabel background colour
    By T4ng10r in forum Qt Programming
    Replies: 19
    Last Post: 19th April 2007, 12:47
  4. Replies: 3
    Last Post: 8th December 2006, 18:51
  5. Replies: 1
    Last Post: 5th April 2006, 16: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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.