diff --git a/qt/BackgroundMap.qml b/qt/BackgroundMap.qml new file mode 100644 index 0000000..34b2a7b --- /dev/null +++ b/qt/BackgroundMap.qml @@ -0,0 +1,19 @@ +import QtQuick 2.4 +import QtQuick.Window 2.0 + +Window { + title: "Background maps" + // A background map is 32 x 32 tiles. + // Each tile is 8 x 8 pixels. + width: 256 + height: 256 + maximumWidth: width + minimumWidth: width + maximumHeight: height + minimumHeight: height + + BackgroundMapForm { + anchors.fill: parent + } + +} diff --git a/qt/BackgroundMapForm.ui.qml b/qt/BackgroundMapForm.ui.qml new file mode 100644 index 0000000..ec6f41b --- /dev/null +++ b/qt/BackgroundMapForm.ui.qml @@ -0,0 +1,33 @@ +import QtQuick 2.4 + +Item { + width: 400 + height: 400 + + Grid { + id: grid1 + x: 0 + y: 0 + width: 256 + height: 256 + rows: 32 + columns: 32 + + Rectangle { + id: rectangle1 + width: 200 + height: 200 + gradient: Gradient { + GradientStop { + position: 0 + color: "#ffffff" + } + + GradientStop { + position: 1 + color: "#000000" + } + } + } + } +} diff --git a/qt/main.qml b/qt/main.qml index bb57182..568df8c 100644 --- a/qt/main.qml +++ b/qt/main.qml @@ -3,6 +3,7 @@ import QtQuick.Controls 1.4 import QtQuick.Dialogs 1.2 ApplicationWindow { + id: root visible: true width: 256 height: 128 @@ -25,7 +26,12 @@ ApplicationWindow { title: qsTr("View") MenuItem { text: qsTr("Background maps") - onTriggered: console.log("Background maps"); + onTriggered: { + console.log("Background maps"); + var component = Qt.createComponent("BackgroundMap.qml") + var bgMap = component.createObject(root) + bgMap.show() + } } } @@ -46,4 +52,5 @@ ApplicationWindow { messageDialog.open(); } } + } diff --git a/qt/qml.qrc b/qt/qml.qrc index 7684346..5cb382a 100644 --- a/qt/qml.qrc +++ b/qt/qml.qrc @@ -2,5 +2,7 @@ main.qml MainForm.ui.qml + BackgroundMap.qml + BackgroundMapForm.ui.qml