Transparency on QStackedWidget?

  • Hello,

    I’m new to the QT world, so if there is a previous post that answers this question please point me at it.

    I'm looking for a little help with the QStackedWidget.

    Is it possible to manipulate the properties such that one layer of the stack is transparent , so that an underlying layer can still be seen? Further can buttons place on this transparent layer also be transparent, but still be activated the same way as if they were not transparent?

    Thank you for any advice or direction that you can provide.

  • Sounds like you are looking for the QGraphicsView framework. Of course you can always place the widgets yourself with setGeometry and some of them could be transparent. But QWidget does not support event propagation for overlapping widgets very well.

  • Thank you, I'll have to investigate. I was hoping to avoid doing much in the way of painting etc.

    If I didn't want the functionality of the button action, but just the transparent overlay? Would that be possible with the QStackedWidget?

  • QStackedWidget is not designed for transparency as far as I know.

  • Ideally QStackedWidget is used to put mutiple widgets in it but only one widget visible at any time (which is on top of the stack). In your case you need a transparent layer (hence another widget which is transparent), hence I don't see any difference if the underlying widget is QStackedWidget or something else. As mentioned before, go for QGraphicsView to create multiple layers.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.