[GUI] Remove MainForm.qml, persist geometry
This commit is contained in:
parent
81dd83226b
commit
8441df260c
3 changed files with 19 additions and 63 deletions
|
|
@ -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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -2,9 +2,12 @@ import QtQuick 2.5
|
||||||
import QtQuick.Controls 1.4
|
import QtQuick.Controls 1.4
|
||||||
import QtQuick.Dialogs 1.2
|
import QtQuick.Dialogs 1.2
|
||||||
|
|
||||||
|
import Qt.labs.settings 1.0
|
||||||
|
|
||||||
import Graphene.Client 0.1
|
import Graphene.Client 0.1
|
||||||
|
|
||||||
ApplicationWindow {
|
ApplicationWindow {
|
||||||
|
id: window
|
||||||
visible: true
|
visible: true
|
||||||
width: 640
|
width: 640
|
||||||
height: 480
|
height: 480
|
||||||
|
|
@ -26,26 +29,25 @@ ApplicationWindow {
|
||||||
|
|
||||||
DataModel {
|
DataModel {
|
||||||
id: model
|
id: model
|
||||||
objectName: "model"
|
}
|
||||||
|
Settings {
|
||||||
|
id: appSettings
|
||||||
|
category: "appSettings"
|
||||||
}
|
}
|
||||||
|
|
||||||
MainForm {
|
Label {
|
||||||
id: form
|
anchors.centerIn: parent
|
||||||
anchors.fill: parent
|
font.pointSize: 75
|
||||||
button1.onClicked: {
|
text: "Dashboard goes here"
|
||||||
console.log(JSON.stringify(model.getAccount(3)))
|
opacity: .5
|
||||||
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))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageDialog {
|
// This Settings is only for geometry -- it doesn't get an id. See appSettings for normal settings
|
||||||
id: messageDialog
|
Settings {
|
||||||
title: qsTr("May I have your attention, please?")
|
category: "windowGeometry"
|
||||||
|
property alias x: window.x
|
||||||
function show(caption) {
|
property alias y: window.y
|
||||||
messageDialog.text = caption;
|
property alias width: window.width
|
||||||
messageDialog.open();
|
property alias height: window.height
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/">
|
<qresource prefix="/">
|
||||||
<file>main.qml</file>
|
<file>main.qml</file>
|
||||||
<file>MainForm.qml</file>
|
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue