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. Move an aligned item in a GridLayout
Forum Updated to NodeBB v4.3 + New Features

Move an aligned item in a GridLayout

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

    I've got a 2x2 Gridlayout. All items are Aligned left and each column spans 50% of the space.

    Now I'd like to move one of the 4 items of the GridLayout 20 pixel more to the right. How do I this?

    @ import QtQuick 2.2
    import QtQuick.Controls 1.2
    import QtQuick.Layouts 1.1

    Gridlayout {
       rows: 2
       flow: GridLayout.TopToBottom
       TextEdit {
          Layout.alignment: Qt.AlignLeft
          text: "test 1"
       }
       Image {
          // This one is supposed to be aligned left + 20 pixels
          source: "awesome-pic.jpg"
       }
       TextEdit {
          Layout.alignment: Qt.AlignLeft
          text: "test 3"
       }
       TextEdit {
          text: "test 4"
       }
    } @
    
    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      Hi,

      Did you try anchoring to left and specifying leftMargin (viz. 20 in your case) ?

      157

      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