Results 1 to 7 of 7

Thread: QGraphicsProxyWidget background

  1. #1
    Join Date
    Jun 2012
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QGraphicsProxyWidget background

    Hi!

    I added a button to the QGraphics Scene:

    QGraphicsProxyWidget *mCloseButton;
    QPushButton *closeButton = new QPushButton( i18n( "Close" ) );
    mCloseButton = scene()->addWidget( closeButton ); //Return QGraphicsProxyWidget

    But around the button I have a gray rectangle.
    ( example: http://kepfeltoltes.hu/view/120623/p...toltes.hu_.png )

    How can I set the background of QGraphicsProxyWidget (mCloseButton) so it can be equal with the background of QGraphicsScene.

  2. #2
    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: QGraphicsProxyWidget background

    Call setAutoFillBackground(false) on the button.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jun 2012
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QGraphicsProxyWidget background

    Quote Originally Posted by wysota View Post
    Call setAutoFillBackground(false) on the button.
    No changing.

  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: QGraphicsProxyWidget background

    Please show how you changed your code.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jun 2012
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QGraphicsProxyWidget background

    Quote Originally Posted by wysota View Post
    Please show how you changed your code.
    I tried this:
    Qt Code:
    1. QGraphicsProxyWidget *mCloseButton;
    2. QPushButton *closeButton = new QPushButton( i18n( "Close" ) );
    3. mCloseButton = scene()->addWidget( closeButton );
    4.  
    5. closeButton->setAutoFillBackground(false);
    To copy to clipboard, switch view to plain text mode 

    and this:

    Qt Code:
    1. QGraphicsProxyWidget *mCloseButton;
    2. QPushButton *closeButton = new QPushButton( i18n( "Close" ) );
    3. mCloseButton = scene()->addWidget( closeButton );
    4.  
    5. mCloseButton->setAutoFillBackground(false);
    To copy to clipboard, switch view to plain text mode 

  6. #6
    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: QGraphicsProxyWidget background

    You also need to set Qt::WA_NoSystemBackground attribute on the button.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Jun 2012
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QGraphicsProxyWidget background

    Quote Originally Posted by wysota View Post
    You also need to set Qt::WA_NoSystemBackground attribute on the button.
    Thanks, works.

Similar Threads

  1. About QGraphicsProxyWidget
    By kehlaaa in forum Qt Programming
    Replies: 0
    Last Post: 19th December 2011, 16:03
  2. QGLWidget in QGraphicsProxyWidget
    By pkj in forum Qt Programming
    Replies: 1
    Last Post: 12th September 2011, 13:42
  3. help positioning QGraphicsProxyWidget?
    By Scott Shiff in forum Qt Programming
    Replies: 1
    Last Post: 24th January 2010, 23:13
  4. QGraphicsItem or QGraphicsProxyWidget?
    By ttvo in forum Qt Programming
    Replies: 5
    Last Post: 30th August 2009, 23:13
  5. QGraphicsProxyWidget
    By QbelcorT in forum Qt Programming
    Replies: 0
    Last Post: 29th November 2008, 08:21

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.