GridLayout fill content bottom to top
-
wrote on 31 Jul 2018, 06:31 last edited by
hello I want to fill my contents from bottom to top.
that means in a gridlayout each rectangle or any content take place in bottom of window and each next rectangle take place in next place and fill window to top.
How can do this?
please help me... -
wrote on 31 Jul 2018, 06:37 last edited by
Something like? :
http://doc.qt.io/qt-5/qml-qtquick-gridview.html#flow-prop -
wrote on 31 Jul 2018, 10:45 last edited by
Thanks for your response...
Yes like this...
but this is TopToBottom...
I want to BottomToTop
How can solve this? -
Thanks for your response...
Yes like this...
but this is TopToBottom...
I want to BottomToTop
How can solve this?@Saman19
most likly by combining it witheffectiveLayoutDirection
, the entry one aboveflowcontrol
in the docu -
wrote on 29 Jul 2022, 09:04 last edited by
Did you fix it? I have the same issue.
-
@Saman19
most likly by combining it witheffectiveLayoutDirection
, the entry one aboveflowcontrol
in the docuwrote on 29 Jul 2022, 09:30 last edited by@J-Hilk I trying to use this but It didnt fix the problem. Have you got any more idea?
-
@J-Hilk I trying to use this but It didnt fix the problem. Have you got any more idea?
@Enrique_PM02 my original comment doesn't seem o lead to the desired conclusion (did some tests) myself
the only thing I can think of is subclassing AbstractItemModel and doing the reversing there
-
wrote on 5 Aug 2022, 07:01 last edited by
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