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. [Solved] Growing a Rectangle "leftwards" or "upwards"

[Solved] Growing a Rectangle "leftwards" or "upwards"

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.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.
  • JKSHJ Offline
    JKSHJ Offline
    JKSH
    Moderators
    wrote on last edited by
    #1

    Hi all,

    My large window contains a medium-sized Rectangle in the middle. This Rectangle contains several small graphical items in arbitrary positions. I'd like to change the size of this outer Rectangle without affecting the global position of the inner items.

    To grow/shrink the right and bottom edges, I just have to change the width/height properties. How do I grow/shrink the left and top edges though?

    I suppose I can do something like:

    Increase the outer Rectangle's width by x pixels

    Move the outer Rectangle to the left by x pixels

    Move every inner item to the right by x pixels

    ...but that seems like an expensive way to do it. Is there a cleaner way?

    Thanks in advance!

    Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jens
      wrote on last edited by
      #2

      You can introduce an intermediate content Item between the outer rectangle (viewport?) and the children. Then all you have to do is to modify the x value of the content item by x pixels and the children will all follow.

      1 Reply Last reply
      0
      • JKSHJ Offline
        JKSHJ Offline
        JKSH
        Moderators
        wrote on last edited by
        #3

        Great idea, Jens. Thanks!

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        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