Skip to content
  • 0 Votes
    1 Posts
    384 Views
    No one has replied
  • 0 Votes
    8 Posts
    2k Views
    U

    Hi! With GridView you can set verticalLayoutDirection: GridView.BottomToTop and it populates items from bottom to up, works fine.

    However with GridLayout there seems to be no such property. One hack to achieve this behaviour with GridLayout would be to rotate the GridLayout component by 180 degrees and counter rotate its children accordingly. You can also use LayoutMirroring property to control left-to-right right-to-left behavior. Depending on what you are trying to achieve this might be a workaround for you.

    Here's example code, (click on window to switch between top-to-bottom and bottom-to-top):

    import QtQuick 2.15 import QtQuick.Window 2.15 import QtQuick.Layouts Window { width: 640 height: 480 visible: true title: qsTr("Hello World") GridLayout { LayoutMirroring.enabled: grid.rotation == 180 id: grid columns: 3 anchors.fill: parent rotation: 0 Text { text: "Three"; font.bold: true; rotation: grid.rotation } Text { text: "words"; color: "red"; rotation: grid.rotation } Text { text: "in"; font.underline: true; rotation: grid.rotation } Text { text: "a"; font.pixelSize: 20; rotation: grid.rotation } Text { text: "row"; font.strikeout: true; rotation: grid.rotation } } MouseArea { anchors.fill: parent onClicked: { if (grid.rotation == 0) grid.rotation = 180 else grid.rotation = 0 } } }

    Regards,
    Ulrich

  • 0 Votes
    1 Posts
    562 Views
    No one has replied
  • 0 Votes
    6 Posts
    2k Views
    M

    I have posted suggestion about adding such positioner to QtQuick:
    https://bugreports.qt.io/browse/QTBUG-57549