October 28, 2011

dmitrij dmitrij
Lab Rat
42 posts

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.

8 replies

October 31, 2011

Mohsen Mohsen
Lab Rat
748 posts

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 it`s 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.

 Signature 

www.madagon.com

November 1, 2011

dmitrij dmitrij
Lab Rat
42 posts

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.

November 1, 2011

Mohsen Mohsen
Lab Rat
748 posts

you can either use Qt::Tool or Qt::SubWindow flags.

 Signature 

www.madagon.com

November 1, 2011

dmitrij dmitrij
Lab Rat
42 posts

I forgot about those flags at all. Thank you!

November 2, 2011

1+1=2 1+1=2
Robot Herder
638 posts

dmitrij wrote:
Hello!

The question is: what I need to reimplement in case I want to change widget’s opacity with its elements?

  1. void QWidget::setGraphicsEffect ( QGraphicsEffect * effect )

And
  1. QGraphicsOpacityEffect

can be used to achive this.

But from this wiki page:
http://developer.qt.nokia.com/wiki/Qt_Modules_Maturity_Level

We can see taht:

  1. Graphics Effects
  2. State: Deprecated
  3. Reasoning: flawed design, we don’t recommend taking maintainership of this code.

November 2, 2011

dmitrij dmitrij
Lab Rat
42 posts


But from this wiki page:
http://developer.qt.nokia.com/wiki/Qt_Modules_Maturity_Level

We can see taht:
@
Graphics Effects
State: Deprecated
Reasoning: flawed design, we don’t recommend taking maintainership of this code.
@

Thank you for answer.
I guess they suppose to introduce something new in nearest future. I’m not sure=) But it seems so.

November 2, 2011

Andre Andre
Robot Herder
6296 posts

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.

 Signature 

Looking for Qt developers to join our team @ i-Optics: https://qt-project.org/forums/viewthread/25393/

November 2, 2011

dmitrij dmitrij
Lab Rat
42 posts

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.

 
  ‹‹ QTestlib and user command line arguments      libvlc_exception_t has not been declared ››

You must log in to post a reply. Not a member yet? Register here!