Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] how to overlap widgets
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] how to overlap widgets

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 28.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    planarian
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dbzhang800
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • P Offline
        P Offline
        planarian
        wrote on last edited by
        #3

        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)

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dbzhang800
          wrote on last edited by
          #4

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

          ...

          1 Reply Last reply
          0
          • P Offline
            P Offline
            planarian
            wrote on last edited by
            #5

            Thanks, that certainly makes life easier!

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved