Results 1 to 5 of 5

Thread: Widgets on Graphicsview backgrounds

  1. #1
    Join Date
    Aug 2006
    Posts
    250
    Thanks
    19
    Thanked 49 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Widgets on Graphicsview backgrounds

    Hey everyone,

    Just trying to put a few widgets onto my scene (using QGraphicsProxyWidget).. That works fairly well, but the problem is that those widgets draw their own background (ie, the style draws it), whereas I want the background to be transparent (so the scene background shows through).

    I attached an example of how it looks.

    Is there any way to tell it not to draw the widget background?
    Attached Images Attached Images

  2. #2
    Join Date
    Jan 2008
    Location
    Finland /Pakistan
    Posts
    216
    Thanks
    20
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Widgets on Graphicsview backgrounds

    QWidget::autoFillBackGround may be helpful...
    for the background to be same as your view/scene see QPalette..
    Hope it Helps..!!

  3. #3
    Join Date
    Aug 2006
    Posts
    250
    Thanks
    19
    Thanked 49 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Widgets on Graphicsview backgrounds

    autoFillBackground didn't seem to have any effect, but setting Qt::WA_NoSystemBackground worked.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Widgets on Graphicsview backgrounds

    Setting the background role of the palette to transparent would probably be sufficient.

  5. #5
    Join Date
    Jul 2008
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Widgets on Graphicsview backgrounds

    I've run into this same problem, and this solution works fine on Windows, but not on Mac OS X. On OS X, I get a solid black background to any widget with this attribute (instead of truly transparent). On one widget, I've seen it behave even worse where the background is completely uninitialized so it's mostly black with some colored noise.

    Anyone have experience with this on this platform?

    Thanks.

Similar Threads

  1. Qt3 - Multiple transparent widgets
    By bythesea in forum Qt Programming
    Replies: 4
    Last Post: 11th September 2009, 11:24
  2. Replies: 2
    Last Post: 16th May 2008, 14:39
  3. widgets behind hidden widgets not working
    By bpetty in forum Newbie
    Replies: 13
    Last Post: 7th September 2007, 20:23
  4. Performance in hiding/showing widgets
    By Paalrammer in forum Newbie
    Replies: 12
    Last Post: 14th February 2007, 18:57
  5. Creating Widgets
    By hylke in forum Qt Programming
    Replies: 2
    Last Post: 5th February 2006, 08:37

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.