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

52 lines
1.2 KiB
QML

// Copyright (c) Daniel Gakwaya.
// SPDX-License-Identifier: MIT
import QtQuick
import QtQuick.Window
Window {
visible: true
width: 640
height: 480
title: qsTr("Repeater")
Flickable {
contentHeight: columnId.implicitHeight
anchors.fill : parent
Column {
id: columnId
anchors.fill: parent
spacing: 2
Repeater {
id: repeaterId
//model: 15
model: ["Jan", "Feb", "March"]
delegate: Rectangle {
width: parent.width
height: 50
color: "dodgerblue"
Text {
anchors.centerIn: parent
text: modelData
font.pointSize: 20
}
MouseArea{
anchors.fill: parent
onClicked: {
console.log("Clicked on: "+modelData)
console.log("count: " + repeaterId.count)
}
}
}
}
}
}
}