Nominate our 2022 Qt Champions!

Overlapping widgets

  • Hello! I am trying to overlap some widgets in a dialog. This is my current structure:


    The blue square is the dialog and the red squares are the layouts.

    The large layout will contain a QGraphicsView and I want to overlap the right layouts on it with the aim that the widgets in the small layouts are on top of it.


    How can I do it?

    Thank you very much!

  • Moderators

    You can use QStackedLayout (or QStackedWidget) and set stackingMode to StackAll.

  • I was trying it but I don't know how to do it. Could you help me? I tryied using QStackedWidget.

  • Moderators

    Looking at the docs, I don't see stackingMode property in QStackedWidget. So, use a layout instead.

    Put the stacked layout in your UI first, then add your big layout, and then the row layout with your small items. You'll need to throw a spacer or dummy layout item into that row layout to keep the big space on the left clean.

Log in to reply