Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 2.2
- import QtQuick.Layouts 1.3
- import org.kde.kirigami 2.1 as Kirigami
- GridView {
- id: view
- width: 500
- height: 500
- property int iconSize: Kirigami.Units.iconSizes.large
- //this checks how many columns fit that are as large as icon size, + margins on the sides
- cellWidth: width / Math.floor(width / (iconSize + Kirigami.Units.largeSpacing*2))
- //size of icon + height of labels(will need 2 lines) + a spacing, top and bottom
- cellHeight: iconSize + Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing*2
- model: 20
- delegate: Item {
- width: view.cellWidth
- height: view.cellHeight
- ColumnLayout {
- anchors {
- left: parent.left
- right: parent.right
- top: parent.top
- topMargin: Kirigami.Units.largeSpacing
- }
- height: cellHeight
- Rectangle {
- Layout.alignment: Qt.AlignHCenter
- color: "red"
- width: view.iconSize
- height: width
- }
- Kirigami.Label {
- //TODO: multiline, text elide etc
- Layout.alignment: Qt.AlignHCenter
- text: "Text label"
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement