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. Dynamically anchoring in QML
Qt 6.11 is out! See what's new in the release blog

Dynamically anchoring in QML

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 1.1k 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.
  • ashajgA Offline
    ashajgA Offline
    ashajg
    wrote on last edited by
    #1

    Hi
    I am having main.qml and Square.qml. I am using Loader to load Square.qml on mouse click from main.qml. I just want to know if I can anchor Square.qml (just a rectangle) with elements of main.qml as soon as it load it? And what is the way that I can use?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      shaan7
      wrote on last edited by
      #2

      You can simply anchor the Loader to the desired elements on main.qml. The Loader will set the loaded item's geometry automatically.
      See http://doc.qt.io/qt-5/qml-qtquick-loader.html#loader-sizing-behavior

      1 Reply Last reply
      2
      • ashajgA Offline
        ashajgA Offline
        ashajg
        wrote on last edited by
        #3

        @shaan7 Thank you very much sir . I ll try this.

        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