oboy/qt/main.qml

57 lines
1.3 KiB
QML
Raw Normal View History

2016-03-06 21:33:37 +01:00
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Dialogs 1.2
ApplicationWindow {
2016-04-18 23:06:17 +02:00
id: root
2016-03-06 21:33:37 +01:00
visible: true
width: 256
height: 128
title: qsTr("OBoy")
menuBar: MenuBar {
Menu {
title: qsTr("File")
MenuItem {
text: qsTr("&Open")
onTriggered: console.log("Open action triggered");
}
MenuItem {
text: qsTr("Exit")
onTriggered: Qt.quit();
}
}
Menu {
title: qsTr("View")
MenuItem {
text: qsTr("Background maps")
2016-04-18 23:06:17 +02:00
onTriggered: {
console.log("Background maps");
var component = Qt.createComponent("BackgroundMap.qml")
var bgMap = component.createObject(root)
bgMap.show()
}
2016-03-06 21:33:37 +01:00
}
}
}
MainForm {
anchors.fill: parent
button1.onClicked: messageDialog.show(qsTr("Button 1 pressed"))
button2.onClicked: messageDialog.show(qsTr("Button 2 pressed"))
}
MessageDialog {
id: messageDialog
title: qsTr("May I have your attention, please?")
function show(caption) {
messageDialog.text = caption;
messageDialog.open();
}
}
2016-04-18 23:06:17 +02:00
2016-03-06 21:33:37 +01:00
}