This commit is contained in:
2025-09-28 17:05:51 +08:00
parent 8eb80ab66d
commit d97fa3e0fe
398 changed files with 18737 additions and 0 deletions

View File

@@ -0,0 +1,67 @@
// Copyright (c) Daniel Gakwaya.
// SPDX-License-Identifier: MIT
import QtQuick
import QtQuick.Window
import QtQml.XmlListModel
Window {
visible: true
width: 640
height: 480
title: qsTr("XmlListModel")
XmlListModel {
id: mXmlListModelId
source: "qrc:/xml/employees.xml"
query: "/courses/course"
XmlListModelRole {
name: "instructor"
elementName: "instructor"
}
XmlListModelRole {
name: "year"
elementName: "year"
}
XmlListModelRole {
name: "coursename"
elementName: "coursename"
}
XmlListModelRole { name: "hot"
elementName: "coursename"
attributeName: "hot"
}
}
ListView{
id: mListViewId
anchors.fill: parent
model : mXmlListModelId
delegate: Rectangle {
width : parent.width
height: 50
color: "beige"
Row {
spacing: 30
Text {
text: instructor
font.pointSize: 15
}
Text {
text: coursename + " (" + year + ")"
font.bold: hot === "true" ? true : false
font.pointSize: 15
}
}
MouseArea {
anchors.fill: parent
onClicked: {
console.log("Clicked on: "+ hot)
}
}
}
}
}