Ugly white borders around QGraphicsProxyWidgets
Is there a way to get rid of the white frames/borders around QGraphicsProxyWidget objects in a QGraphicsScene?
You should add which OS/Qt versions you are using and what kind of widget you are putting on your scene.
This post is deleted!
Oh, sorry. I completely forgot this rather important info :D
Running on linux mint 17.2, but i'm looking to target also at least osx and windows. Qt version i'm using is 5.2.1, because ubuntu and derivatives based on 14.04 are using that.
The widgets i'm adding to the scene are a few push buttons, a text browser, and a line edit. It's most noticeable on the push buttons and the line edit, there's 1 pixel of extra white frame around the widgets that have opacity over the GL content.
Here's a quick screenshot that illustrates these white borders around proxy widgets:
Thanks for any help!
Is your Play button directly put in a QGraphicsProxyWidget ?
Yes, in my QGraphicsScene subclass constructor i do:
Qt::WindowFlags flags = Qt::Widget; /* [ ... ] */ play_button = new QPushButton (_("PLAY")); /* yeah i use gettext in this project */ proxywidget_play_button = addWidget (play_button, flags); /* ... same for other widgets */
... a CSS property might do the trick maybe?
I don't remember a trick to do it directly for the button but is you put it in a layout in a QWidget you can setup the content margins of the widget to be close enough to the button has to not have that space.
Seems like a good solution. Can you provide a quick example?
play_button->setAttribute(Qt::WA_TranslucentBackground)may do what you want
widget->setContentsMargins(-W, -X, -Y, -Z)
But @MajidKamali's proposition is also good. However, you'll have to check whether it also fits your need for the more complex widgets.
Thanks very much for the information guys! Qt::WA_TranslucentBackground does the trick :D