From 2daafde7f24a19ac7b1a407e1899da2a5bc8f2db Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Sat, 18 Feb 2023 15:54:41 +0100 Subject: [PATCH] Move StatusBar into its own file --- CMakeLists.txt | 1 + LightControlWindow.qml | 49 +--------------------------------------- StatusBar.qml | 51 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 48 deletions(-) create mode 100644 StatusBar.qml diff --git a/CMakeLists.txt b/CMakeLists.txt index c1c243b..28768e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,7 @@ qt_add_qml_module(applightcontrol DevicesSettingsPage.qml Vector3DField.qml DmxSlider.qml + StatusBar.qml ) set_target_properties(applightcontrol PROPERTIES diff --git a/LightControlWindow.qml b/LightControlWindow.qml index 0dc7058..6b71455 100644 --- a/LightControlWindow.qml +++ b/LightControlWindow.qml @@ -28,56 +28,9 @@ ApplicationWindow { ColumnLayout { anchors.fill: parent - Pane { + StatusBar { Layout.fillWidth: true Layout.preferredHeight: 75 - - Material.elevation: 6 - - z: 999 - - RowLayout { - anchors.fill: parent - - Label { - Layout.fillWidth: true - Layout.fillHeight: true - - text: qsTr("Schein-Commander") - fontSizeMode: Text.VerticalFit - minimumPixelSize: 10; - font.pixelSize: 72 - } - - Label { - id: timeText - Layout.fillWidth: true - Layout.fillHeight: true - - text: Qt.formatTime(new Date(), "hh:mm:ss") - fontSizeMode: Text.VerticalFit - minimumPixelSize: 10; - font.pixelSize: 72 - - Timer { - id: timer - interval: 1000 - repeat: true - running: true - - onTriggered: timeText.text = Qt.formatTime(new Date(), "hh:mm:ss"); - } - } - - Button { - Layout.fillHeight: true - - text: qsTr("Back") - - onClicked: stackview.pop(); - enabled: stackview.depth > 1 - } - } } StackView { diff --git a/StatusBar.qml b/StatusBar.qml new file mode 100644 index 0000000..bee8de1 --- /dev/null +++ b/StatusBar.qml @@ -0,0 +1,51 @@ +import QtQuick +import QtQuick.Controls.Material +import QtQuick.Layouts + +Pane { + Material.elevation: 6 + + z: 999 + + RowLayout { + anchors.fill: parent + + Label { + Layout.fillWidth: true + Layout.fillHeight: true + + text: qsTr("Schein-Commander") + fontSizeMode: Text.VerticalFit + minimumPixelSize: 10; + font.pixelSize: 72 + } + + Label { + Layout.fillWidth: true + Layout.fillHeight: true + + text: Qt.formatTime(new Date(), "hh:mm:ss") + fontSizeMode: Text.VerticalFit + minimumPixelSize: 10; + font.pixelSize: 72 + + Timer { + id: timer + interval: 1000 + repeat: true + running: true + + onTriggered: parent.text = Qt.formatTime(new Date(), "hh:mm:ss"); + } + } + + Button { + Layout.fillHeight: true + + text: qsTr("Back") + + onClicked: stackview.pop(); + enabled: stackview.depth > 1 + } + } +}