PDA

View Full Version : Transparent Dialog



wirasto
11th November 2009, 20:11
Can I set transparent for Dialog, but not for widget ?

I tried like this, but not work.



setWindowOpacity(0.1);
m_ui->lineEdit->setWindowOpacity(1.0);

squidge
11th November 2009, 21:02
Wouldn't that be kind of daft? Having widgets with different opacity levels than the window itself?

aamer4yu
12th November 2009, 05:09
You will need to play around with Qt::WA_TranslucentBackground to get that effect ( semi transparent main window and opaque child widgets)

wirasto
12th November 2009, 10:11
Not work :( Just make dialog background is black.



setWindowOpacity(0.1);
setAttribute(Qt::WA_TranslucentBackground);

m_ui->lineEdit->setWindowOpacity(1.0);

spirit
12th November 2009, 10:21
the doc for Qt::WA_TranslucentBackground says


Indicates that the widget should have a translucent background, i.e., any non-opaque regions of the widgets will be translucent because the widget will have an alpha channel. Setting this flag causes WA_NoSystemBackground to be set. On Windows the widget also needs the Qt::FramelessWindowHint window flag to be set. This flag is set or cleared by the widget's author.