Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

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

    QML and Qt Quick
    4
    13
    4540
    Loading More Posts
    • 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
      Arkning last edited by

      Hi,

      So I wanted to anchor an element with an another that isn't in the same parent, I know QML says me that is not possible but is there a way of doing it ?

      Thanks in advance for your answer !

      1 Reply Last reply Reply Quote 0
      • dheerendra
        dheerendra Qt Champions 2022 last edited by

        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
        http://www.pthinks.com

        A 1 Reply Last reply Reply Quote 0
        • A
          Arkning @dheerendra last edited by

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

          1 Reply Last reply Reply Quote 0
          • dheerendra
            dheerendra Qt Champions 2022 last edited by

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

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

            1 Reply Last reply Reply Quote 2
            • johngod
              johngod last edited by

              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 Reply Quote 0
              • A
                Arkning @johngod last edited by

                @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 Reply Quote 0
                • E
                  Eeli K @Arkning last edited by

                  @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 Reply Quote 0
                  • A
                    Arkning @Eeli K last edited by

                    @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 Reply Quote 0
                    • johngod
                      johngod last edited by

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

                      A 1 Reply Last reply Reply Quote 0
                      • A
                        Arkning @johngod last edited by

                        @johngod alt text

                        1 Reply Last reply Reply Quote 0
                        • E
                          Eeli K @Arkning last edited by

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

                          A 1 Reply Last reply Reply Quote 0
                          • A
                            Arkning @Eeli K last edited by

                            @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 Reply Quote 0
                            • johngod
                              johngod last edited by johngod

                              @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 Reply Quote 1
                              • First post
                                Last post