[GUI] Remove MainForm.qml, persist geometry

This commit is contained in:
Nathan Hourt 2015-07-10 18:54:54 -04:00
parent 81dd83226b
commit 8441df260c
3 changed files with 19 additions and 63 deletions

View file

@ -1,45 +0,0 @@
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.2
Item {
id: item1
width: 640
height: 480
property alias button1: button1
property alias button2: button2
ColumnLayout {
id: columnLayout1
width: parent.width / 2
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
RowLayout {
id: buttonRow
Layout.fillWidth: true
Button {
id: button1
text: qsTr("Press Me 1")
}
Item { Layout.fillWidth: true }
Button {
id: button2
text: qsTr("Press Me 2")
}
}
Slider {
id: slider
Layout.fillWidth: true
}
ProgressBar {
id: progressBar1
value: Math.sin(Math.PI * slider.value)
Layout.fillWidth: true
}
}
}

View file

@ -2,9 +2,12 @@ import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Dialogs 1.2
import Qt.labs.settings 1.0
import Graphene.Client 0.1
ApplicationWindow {
id: window
visible: true
width: 640
height: 480
@ -26,26 +29,25 @@ ApplicationWindow {
DataModel {
id: model
objectName: "model"
}
Settings {
id: appSettings
category: "appSettings"
}
MainForm {
id: form
anchors.fill: parent
button1.onClicked: {
console.log(JSON.stringify(model.getAccount(3)))
messageDialog.show(qsTr("Account name is %1").arg(model.getAccount(3).name))
}
button2.onClicked: messageDialog.show(qsTr("Account name is %1").arg(model.getAccount("steve").name))
Label {
anchors.centerIn: parent
font.pointSize: 75
text: "Dashboard goes here"
opacity: .5
}
MessageDialog {
id: messageDialog
title: qsTr("May I have your attention, please?")
function show(caption) {
messageDialog.text = caption;
messageDialog.open();
}
// This Settings is only for geometry -- it doesn't get an id. See appSettings for normal settings
Settings {
category: "windowGeometry"
property alias x: window.x
property alias y: window.y
property alias width: window.width
property alias height: window.height
}
}

View file

@ -1,7 +1,6 @@
<RCC>
<qresource prefix="/">
<file>main.qml</file>
<file>MainForm.qml</file>
</qresource>
</RCC>