QWidget with parent fully transparent
-
Hello!
I'm trying to change a qwidget opacity, when it has a parent. As I found out the setWindowOpacity is working only for a window without parent. I tried to reimplement paintEvent for the widget. But in this case I changed only widget's opacity(made its background a bit transparant), not its elements. The question is: what I need to reimplement in case I want to change widget's opacity with its elements?
Thank you for your answers beforehand.
-
when a widget has parent then it has no background except when it opened window like. other states you may use a label as your background and objects opacity can be changed via style or opacity property.
but if its window like,what
s the reason to give it a parent? you can already show a widget with modal flag or if you need to have access to parent window just keep the parent widget on another pointer. -
Thank you for your answer.
Good question about the reason. I'm starting thinking, I don't need it anymore actually, if of course with a modal flag the window icon will not appear in a task bar. At this moment I know only way to hide icon from task bar: parent adding.
-
you can either use Qt::Tool or Qt::SubWindow flags.
-
I forgot about those flags at all. Thank you!
-
[quote author="dmitrij" date="1319837582"]Hello!
The question is: what I need to reimplement in case I want to change widget's opacity with its elements?
[/quote]@
void QWidget::setGraphicsEffect ( QGraphicsEffect * effect )
@
And
@
QGraphicsOpacityEffect
@
can be used to achive this.But from this wiki page:
http://developer.qt.nokia.com/wiki/Qt_Modules_Maturity_LevelWe can see taht:
@
Graphics Effects
State: Deprecated
Reasoning: flawed design, we don’t recommend taking maintainership of this code.
@ -
[quote]
But from this wiki page:
http://developer.qt.nokia.com/wiki/Qt_Modules_Maturity_LevelWe can see taht:
@
Graphics Effects
State: Deprecated
Reasoning: flawed design, we don’t recommend taking maintainership of this code.
@[/quote]Thank you for answer.
I guess they suppose to introduce something new in nearest future. I'm not sure=) But it seems so. -
The new thing they introduced is called QML/Qt Quick. That UI framework is much more suited to doing graphics effects like this. Making these fluent, animated bling UI's using QWidgets just doesn't work out nicely, even if there are tricks you can use to do some of these.
-
I didn't try QML/Qt Quick still. Currently was another goal - study basics of this FrameWork and trying to do something cool and nice with that. Without basics the jump to QML would have been a very stupid step.