Unsolved ListView, 4 avatars, 2 rows, 2 columns, how to do?
-
Hello, I have 4 avatars and I need to have them organised on 2 rows and 2 columns, could you help me?
import QtQuick 2.6 import QtQuick.Controls 2.1 import Qt3D.Extras 2.0 Page { id: root header: ToolBar { Label { text: qsTr("KARDEX") font.pixelSize: 50 color: "lightgrey" anchors.centerIn: parent font.family: "Times New Roman" font.bold: true font.italic: true } background: Rectangle { gradient: Gradient { GradientStop { position: 0 ; color: "black" } GradientStop { position: 1 ; color: "green" } } } } ListView { id: listView anchors.fill: parent topMargin: 48 leftMargin: 48 bottomMargin: 48 rightMargin: 48 spacing: 20 model: ["LNx4", "LPx4", "GBx4","LTx4"] delegate: ItemDelegate { //text: modelData width: avatar.implicitWidth height: avatar.implicitHeight leftPadding: avatar.implicitWidth + 32 onClicked: root.StackView.view.push("qrc:/ataPage.qml", { inConversationWith: modelData }) Image { id: avatar source: "qrc:/images/" + modelData.replace(" ", "_") + ".png" } } } }
Thanks a lot