Results 1 to 3 of 3

Thread: Creating semitransparent widget over QGraphicsView

  1. #1
    Join Date
    Jan 2010
    Posts
    190
    Thanks
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Creating semitransparent widget over QGraphicsView

    Hi! I'm trying to overlap a transparent widget to a QGraphicsView. I created it with:

    Qt Code:
    1. MyWidget* widget = new MyWidget(this);
    2. widget->show();
    To copy to clipboard, switch view to plain text mode 

    and I noticed it results not to be semitransparent. If, instead, I create it in a subclass of the QGraphicsScene placed in the QGraphicsView whose parent is my QMainWindow, like:

    Qt Code:
    1. MyWidget* widget = new MyWidget((QWidget*)this->parent());
    2. widget->show();
    To copy to clipboard, switch view to plain text mode 

    I get that it is semitransparent. Why?
    Thanks!

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Creating semitransparent widget over QGraphicsView

    What is 'this' in the first code ?

  3. #3
    Join Date
    Jan 2010
    Posts
    190
    Thanks
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Creating semitransparent widget over QGraphicsView

    'this' in the first code was referring to my subclass of the QGraphicsView. Now I managed to get it work, but unfortunately I don't know how... I must have changed something while hacking and now seems to work in both the ways I reported.
    Anyway, I noticed transparency doesn't work in case the widget is created with a NULL parent: is this correct?
    Thanks for your time!

Similar Threads

  1. Replies: 1
    Last Post: 30th October 2009, 20:02
  2. Creating an OSX-like dock widget
    By k2 in forum Qt Programming
    Replies: 0
    Last Post: 1st June 2009, 22:16
  3. Creating a QAccessibleWidget object for widget
    By Rakesh_Kumar in forum Qt Programming
    Replies: 0
    Last Post: 27th January 2009, 08:13
  4. Background image and semitransparent widget
    By asieriko in forum Qt Programming
    Replies: 3
    Last Post: 20th August 2007, 16:43
  5. Creating a widget on a QGraphicsView
    By maverick_pol in forum Qt Programming
    Replies: 4
    Last Post: 9th August 2007, 17:54

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.