[SOLVED] how to overlap widgets



  • 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?



  • All of A, B and C can be children of another QWidget D.



  • 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 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,

    ...



  • Thanks, that certainly makes life easier!


Log in to reply
 

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