forked from denis/a811
66 lines
1.7 KiB
QML
66 lines
1.7 KiB
QML
// Includes relevant modules used by the QML
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
import QtQuick.Controls as Controls
|
|
import org.kde.kirigami as Kirigami
|
|
import CustomComponents 1.0
|
|
|
|
// Provides basic features needed for all kirigami applications
|
|
Kirigami.ApplicationWindow {
|
|
// Unique identifier to reference this object
|
|
id: root
|
|
|
|
width: 400
|
|
height: 300
|
|
|
|
property var devices: Conf.deviceList
|
|
|
|
function updateDevices() {
|
|
|
|
for (var i = 0; i < devices.length; i++) {
|
|
var component = Qt.createComponent("action.qml");
|
|
var sprite = component.createObject(null, {
|
|
text: devices[i],
|
|
shortcut: StandardKey.Quit
|
|
});
|
|
|
|
drawer.actions.push(sprite);
|
|
if (sprite == null) {
|
|
// Error Handling
|
|
console.log("Error creating object");
|
|
}
|
|
}
|
|
}
|
|
|
|
// Window title
|
|
// i18nc() makes a string translatable
|
|
// and provides additional context for the translators
|
|
title: i18nc("@title:window", "Hello World")
|
|
|
|
globalDrawer: Kirigami.GlobalDrawer {
|
|
id: drawer
|
|
isMenu: true
|
|
actions: []
|
|
Component.onCompleted: updateDevices()
|
|
}
|
|
|
|
// Set the first page that will be loaded when the app opens
|
|
// This can also be set to an id of a Kirigami.Page
|
|
pageStack.initialPage: Kirigami.Page {
|
|
id: main
|
|
Controls.Label {
|
|
// Center label horizontally and vertically within parent object
|
|
anchors.centerIn: parent
|
|
text: i18n("Hello World!")
|
|
}
|
|
Component {
|
|
id: nameDelegate
|
|
Text {
|
|
text: model.display
|
|
font.pixelSize: 32
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|