[SOLVED] how to overlap widgets
-
wrote on 11 Apr 2012, 18:57 last edited by
I know that a common technique for overlapping two widgets is to make the displayed widget the child of the concealed one. But what if you have a widget partially covering two others? Say I have squares A, B, and C of type QWidget, where A covers one of B's corners and one of C's. Since A can only have one parent, what would be the best way to achieve this?
-
wrote on 11 Apr 2012, 19:28 last edited by
All of A, B and C can be children of another QWidget D.
-
wrote on 11 Apr 2012, 20:05 last edited by
But if A, B, and C all have the same parent, what determines their relationship to one another?
If parent-child is the only method, can it be accomplished by having C be the parent of B, and B the parent of A? (I'm assuming here that C can be the parent of B even though they're disjoint)
-
wrote on 11 Apr 2012, 20:19 last edited by
[quote author="planarian" date="1334174729"]But if A, B, and C all have the same parent, what determines their relationship to one another?
If parent-child is the only method, can it be accomplished by having C be the parent of B, and B the parent of A? (I'm assuming here that C can be the parent of B even though they're disjoint)[/quote]
Once they belong to the same parent, order of them is controlled by z-order.
For QWidget,
QWidget::lower()
QWidget::raise()
QWidget::stackUnder()For QGraphicsItem,
QGraphicsItem::setZValue()
QGraphicsItem::stackBefore()
QGraphicsItem::ItemStacksBehindParent
...For Qt Quick,
...
-
wrote on 11 Apr 2012, 20:23 last edited by
Thanks, that certainly makes life easier!
1/5