PDA

View Full Version : how to make transparent qgraphicsproxywidget



wagmare
29th October 2013, 04:06
hi friends,
how can i add a QSlider with groove as transparent but not the handle and add the widget as a QGraphicsProxyWidget i tried like this ..

theSlider->setStyleSheet("QSlider::groove:horizontal {background-color: rgba(255, 255, 255, 50);} QSlider::handle:horizontal {background: black;};");

QGraphicsProxyWidget *sliderItem = new QGraphicsProxyWidget(this);
// sliderItem->setOpacity(0.3);
sliderItem->setWidget(theSlider);

if i enable opacity its showing transparent slider but handle also looks transparent .
if i make background-color : transparent .. it is looking like a white box ...
how to make the widget transparent in qgraphicsproxywidget ..

please help me ..

wagmare
29th October 2013, 08:09
can anyone please
help me how i can add a semi transparent QGraphicsProxy widget to scene

spirit
29th October 2013, 08:49
Did you try to use QSS's opacity property?

wagmare
29th October 2013, 09:56
u mean setWindowOpacity() ..?
yes i did that .. its making the whole slider transparent ..

spirit
29th October 2013, 10:00
No, I mean Qt Style Sheet's opacity (http://qt-project.org/doc/qt-4.7/stylesheet-reference.html#id-6a4711aa-0d3e-45f9-8686-165873c5c349).

wagmare
29th October 2013, 11:00
thx spirit ...


QWidget *wid = new QWidget;


QPalette palette ;
palette.setBrush(QPalette::Background, Qt::transparent);
wid->setPalette(palette);

wid->setAutoFillBackground(false);

theSlider = new QSlider(wid);

theSlider->setStyleSheet("background-color:transparent");

graphicsProxyItem->setWidget(wid);