From 8441df260ca6b0db9a25b275a47f2fabbf1c7b88 Mon Sep 17 00:00:00 2001 From: Nathan Hourt Date: Fri, 10 Jul 2015 18:54:54 -0400 Subject: [PATCH 1/2] [GUI] Remove MainForm.qml, persist geometry --- programs/light_client/qml/MainForm.qml | 45 -------------------------- programs/light_client/qml/main.qml | 36 +++++++++++---------- programs/light_client/qml/qml.qrc | 1 - 3 files changed, 19 insertions(+), 63 deletions(-) delete mode 100644 programs/light_client/qml/MainForm.qml diff --git a/programs/light_client/qml/MainForm.qml b/programs/light_client/qml/MainForm.qml deleted file mode 100644 index 04c2d926..00000000 --- a/programs/light_client/qml/MainForm.qml +++ /dev/null @@ -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 - } - } -} - diff --git a/programs/light_client/qml/main.qml b/programs/light_client/qml/main.qml index 49202020..7ea0739c 100644 --- a/programs/light_client/qml/main.qml +++ b/programs/light_client/qml/main.qml @@ -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 } } diff --git a/programs/light_client/qml/qml.qrc b/programs/light_client/qml/qml.qrc index a9442bbc..0ff3892d 100644 --- a/programs/light_client/qml/qml.qrc +++ b/programs/light_client/qml/qml.qrc @@ -1,7 +1,6 @@ main.qml - MainForm.qml From af638cdd6dbca3610a9e06413d53ffd4bcbf1a71 Mon Sep 17 00:00:00 2001 From: theoreticalbts Date: Sat, 11 Jul 2015 16:23:49 -0400 Subject: [PATCH 2/2] light_client: Don't use AUTORCC as it requires CMake 3+ --- programs/light_client/CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/programs/light_client/CMakeLists.txt b/programs/light_client/CMakeLists.txt index 66236369..c6f0c344 100644 --- a/programs/light_client/CMakeLists.txt +++ b/programs/light_client/CMakeLists.txt @@ -6,14 +6,16 @@ project(light_client) set(CMAKE_INCLUDE_CURRENT_DIR ON) # Instruct CMake to run moc automatically when needed. set(CMAKE_AUTOMOC ON) -# Instruct CMake to run rcc automatically when needed. -set(CMAKE_AUTORCC ON) find_package(Qt5Core) find_package(Qt5Widgets) find_package(Qt5Quick) file(GLOB QML qml/*) -add_executable(light_client ClientDataModel.cpp ClientDataModel.hpp main.cpp ${QML}) + +qt5_add_resources(QML_QRC qml/qml.qrc) + +add_executable(light_client ClientDataModel.cpp ClientDataModel.hpp main.cpp ${QML_QRC}) +add_dependencies(light_client gen_qrc) target_link_libraries(light_client PRIVATE Qt5::Core Qt5::Widgets Qt5::Quick graphene_chain graphene_utilities fc)