Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Overlapping widgets



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

    f0d1c1a7-ed10-4d32-afda-badf9959f82e-image.png

    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.

    41a526d8-32da-4a0c-9063-fae565fdb351-image.png

    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