Solved Merging Elements in Grid possible?
-
Hello,
I am setting up a List of Values, each with an Icon and some Text showing. For Layouting I use
Grid
in QML with three columns and it looks really nice so far.But now I am at a point where I would need an Icon exactly three times as wide as a normal Icon so I was searching for a way to merge the three cells in that row to a single one. I tried to increase the Size of the single Item but this rearranges the other Icons as well.
Since the Documentation on Grid QML (http://doc.qt.io/qt-5/qml-qtquick-grid.html) don't mention anything I wonder if there is a way to force the single Item to use a whole row alone.
Thanks in Advance
-
@Throndar I am afraid it is not possible with Grid. You might want to look at GridLayout as this allows for spanning, so maybe you can use that instead. See http://doc.qt.io/qt-5/qml-qtquick-layouts-gridlayout.html
-
An other option, additional to what @AndyS wrote, would be using
GridView
.By what you wrote, all Items, that are to be displayed, follow the same pattern, Icon & Text. Therefore a GridView with a delegate could be a valid option.
You can set the width and hight of each item individial. So setting the witdh * 3 times tmore han normal could be easily bound to some property. -
thank you very much.
GridLayout seems to be a lot more usable for my existing Design than Grid.
The GridView itself looks quite promising and I hoped I would have remembered this before building every single Container (each with two Text-Items, one Image, one MouseArea) from hand... but rather late than never ;) I think this definitely calls for a refactoring.
Once again, thank you. This helped a lot.