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. How to anchor elements that they aren't in the same parent or sibling ?
Qt 6.11 is out! See what's new in the release blog

How to anchor elements that they aren't in the same parent or sibling ?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
13 Posts 4 Posters 9.5k 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.
  • dheerendraD Offline
    dheerendraD Offline
    dheerendra
    Moderators Qt Champions 2024 Qt Champions 2022 Qt Champions 2017
    wrote on last edited by
    #2

    Not possible. You can anchor only to parent or sibling. If u want anchor it, change the parent & do necessary anchoring.

    Dheerendra
    @Community Service
    Certified Qt Specialist
    https://www.pthinks.com

    A 1 Reply Last reply
    0
    • dheerendraD dheerendra

      Not possible. You can anchor only to parent or sibling. If u want anchor it, change the parent & do necessary anchoring.

      A Offline
      A Offline
      Arkning
      wrote on last edited by
      #3

      @dheerendra But I can't change the parent...

      1 Reply Last reply
      0
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Moderators Qt Champions 2024 Qt Champions 2022 Qt Champions 2017
        wrote on last edited by
        #4

        Then you can't anchor it. Use other layout mechanism to achieve your requirement.

        Dheerendra
        @Community Service
        Certified Qt Specialist
        https://www.pthinks.com

        1 Reply Last reply
        2
        • johngodJ Offline
          johngodJ Offline
          johngod
          wrote on last edited by
          #5

          Can you show a draft of the layout that you want to achieve ? Maybe we can figure something out of it.

          A 1 Reply Last reply
          0
          • johngodJ johngod

            Can you show a draft of the layout that you want to achieve ? Maybe we can figure something out of it.

            A Offline
            A Offline
            Arkning
            wrote on last edited by
            #6

            @johngod 0_1495526481026_qt_forum.png

            So I want the text "Arrêt 2" is anchor with the text "Identifiant user :"

            E 1 Reply Last reply
            0
            • A Arkning

              @johngod 0_1495526481026_qt_forum.png

              So I want the text "Arrêt 2" is anchor with the text "Identifiant user :"

              E Offline
              E Offline
              Eeli K
              wrote on last edited by
              #7

              @Arkning Sorry but there's no image, try again or put it to some publicly available image or file service and give a link.

              A 1 Reply Last reply
              0
              • E Eeli K

                @Arkning Sorry but there's no image, try again or put it to some publicly available image or file service and give a link.

                A Offline
                A Offline
                Arkning
                wrote on last edited by
                #8

                @Eeli-K But I can see the picture don't know why you can see it, but anyway there is the link : https://forum.qt.io/uploads/files/1495526481427-qt_forum.png

                E 1 Reply Last reply
                0
                • johngodJ Offline
                  johngodJ Offline
                  johngod
                  wrote on last edited by
                  #9

                  None of those links work for me, I can't see the picture.

                  A 1 Reply Last reply
                  0
                  • johngodJ johngod

                    None of those links work for me, I can't see the picture.

                    A Offline
                    A Offline
                    Arkning
                    wrote on last edited by
                    #10

                    @johngod alt text

                    1 Reply Last reply
                    0
                    • A Arkning

                      @Eeli-K But I can see the picture don't know why you can see it, but anyway there is the link : https://forum.qt.io/uploads/files/1495526481427-qt_forum.png

                      E Offline
                      E Offline
                      Eeli K
                      wrote on last edited by
                      #11

                      @Arkning The linked page shows only text "Not found", nothing else.

                      A 1 Reply Last reply
                      0
                      • E Eeli K

                        @Arkning The linked page shows only text "Not found", nothing else.

                        A Offline
                        A Offline
                        Arkning
                        wrote on last edited by
                        #12

                        @Eeli-K So I don't know what to do except describing you what I want or maybe I can send you the source code compile it and see what I want ?
                        But anyway imagine just you have a rectangle and you have a Text under it at approximatively 2/5 of the width of the rectangle. So I want to anchor a text that is inside the rectangle with the left or right of the Text under the Rectangle.

                        1 Reply Last reply
                        0
                        • johngodJ Offline
                          johngodJ Offline
                          johngod
                          wrote on last edited by johngod
                          #13

                          @Arkning Got it. So do it like this, put both texts inside the Rectangle, the Rectangle being the parent of both. Then you want one text to be under the rectangle, so use a anchor with a negative value. That should work.

                          Regarding the link to the image not working, I think its currently a bug on the forum, you should use a external service like https://imagebin.ca/ or something similar, and just paste the link of the image here.

                          1 Reply Last reply
                          1

                          • Login

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