Move an aligned item in a GridLayout



  • 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"
       }
    } @

  • Moderators

    Hi,

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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.