Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Anchoring element's centers to the top of another element/ Overlaying elements
Qt 6.11 is out! See what's new in the release blog

Anchoring element's centers to the top of another element/ Overlaying elements

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 720 Views
  • 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.
  • A Offline
    A Offline
    abanksdev
    wrote on last edited by
    #1

    Hi there,

    Can someone point in the right direction to achieve overlaying two QML elements as depicted in the picture below?

    0_1536530823953_overlayExample.png

    The purple item needs to be centered right at the top of the pink item through some method. Please advise!

    DiracsbracketD 1 Reply Last reply
    0
    • A abanksdev

      Hi there,

      Can someone point in the right direction to achieve overlaying two QML elements as depicted in the picture below?

      0_1536530823953_overlayExample.png

      The purple item needs to be centered right at the top of the pink item through some method. Please advise!

      DiracsbracketD Offline
      DiracsbracketD Offline
      Diracsbracket
      wrote on last edited by Diracsbracket
      #2

      @abanksdev

          Rectangle {
              id: rect1
              y: 200
              height: 100
              width: 500
              color: "pink"
          }
      
          Rectangle {
              anchors.horizontalCenter: rect1.horizontalCenter
              anchors.verticalCenter: rect1.top
              height: 100
              width: 100
              color: "purple"
          }
      

      0_1536545707186_4b896129-d9df-42f4-8cdd-b86488ee2ce1-image.png

      Or, if you meant:

      0_1536546038865_1b4a93cd-e691-458f-aa3b-f20a9e6a882f-image.png

          Rectangle {
              anchors.horizontalCenter: rect1.horizontalCenter
              anchors.bottom: rect1.top
              height: 100
              width: 100
              color: "purple"
          }
      
      1 Reply Last reply
      2

      • Login

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