Files
qt6-qml-for-beginners/Qt6QMLBeginnersCode/11-ModelViewArchitecture/3-InlineModels/Main.qml
2025-09-28 17:05:51 +08:00

44 lines
989 B
QML

// Copyright (c) Daniel Gakwaya.
// SPDX-License-Identifier: MIT
import QtQuick
import QtQuick.Window
Window {
id: rootId
visible: true
width: 640
height: 480
title: qsTr("Inline Model")
ListView {
id: mListViewId
anchors.fill: parent
//model : ["January", "February", "March", "April", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec"]
model: 100
delegate: Rectangle {
id: rectangleId
width: rootId.width
height: 50
color: "beige"
border.color: "yellowgreen"
radius: 10
Text {
id: textId
anchors.centerIn: parent
font.pointSize: 20
text: modelData
}
MouseArea {
anchors.fill: parent
onClicked: {
console.log("Clicked on: "+ modelData)
}
}
}
}
}