From 77fa4e37c852d29b12cd46b00497cdfc0ab0f344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Fri, 9 Oct 2015 02:45:22 +0200 Subject: [PATCH] QML-UI: add more properties to Units and Theme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - colors for accentuation (background and text) - text color to paint on highlights - units.spacing (derived from gridUnit, so it's dpi-corrected) - port main.qml, especially the application header to this theming and sizing Signed-off-by: Sebastian Kügler Signed-off-by: Dirk Hohndel --- qt-mobile/main.qml | 34 +++++++++++++++------------------- qt-mobile/theme/Theme.qml | 3 +++ qt-mobile/theme/Units.qml | 1 + 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/qt-mobile/main.qml b/qt-mobile/main.qml index 00ab008d3..34817e998 100644 --- a/qt-mobile/main.qml +++ b/qt-mobile/main.qml @@ -86,43 +86,39 @@ ApplicationWindow { ColumnLayout { id: awLayout anchors.fill: parent - spacing: 8 + spacing: units.gridUnit / 2 Rectangle { id: topPart - color: "#2C4882" - Layout.minimumHeight: prefsButton.height * 1.2 + color: theme.accentColor + Layout.minimumHeight: units.gridUnit * 2 + units.spacing * 2 Layout.fillWidth: true - anchors.bottom: detailsPage.top - anchors.bottomMargin: prefsButton.height * 0.1 Layout.margins: 0 RowLayout { anchors.bottom: topPart.bottom - anchors.bottomMargin: prefsButton.height * 0.1 + anchors.bottomMargin: units.spacing anchors.left: topPart.left - anchors.leftMargin: prefsButton.height * 0.1 + anchors.leftMargin: units.spacing anchors.right: topPart.right - anchors.rightMargin: prefsButton.height * 0.1 + anchors.rightMargin: units.spacing Text { text: qsTr("Subsurface mobile") font.pointSize: 18 - font.bold: true - color: "white" - anchors.horizontalCenter: parent.horizontalCenter - horizontalAlignment: Text.AlignHCenter + color: theme.accentTextColor } Button { id: prefsButton text: "\u22ee" anchors.right: parent.right - Layout.preferredWidth: Screen.width * 0.1 + Layout.preferredWidth: units.gridUnit * 2 + Layout.preferredHeight: units.gridUnit * 2 style: ButtonStyle { background: Rectangle { - implicitWidth: 50 - color: "#2C4882" + implicitWidth: units.gridUnit * 2 + color: theme.accentColor } label: Text { id: txt - color: "white" + color: theme.accentTextColor font.pointSize: 18 font.bold: true text: control.text @@ -146,7 +142,7 @@ ApplicationWindow { DiveList { anchors.fill: detailsPage id: diveDetails - color: "#2C4882" + color: theme.backgroundColor } } @@ -157,9 +153,9 @@ ApplicationWindow { Text { id: message - color: "#000000" + color: theme.textColor text: "" - styleColor: "#ff0000" + styleColor: theme.textColor font.pointSize: 10 } } diff --git a/qt-mobile/theme/Theme.qml b/qt-mobile/theme/Theme.qml index 5eed83fe8..021b2f2aa 100644 --- a/qt-mobile/theme/Theme.qml +++ b/qt-mobile/theme/Theme.qml @@ -1,7 +1,10 @@ import QtQuick 2.3 QtObject { + property color accentColor: "#114d6f" + property color accentTextColor: "#ececec" property color textColor: "#333333" property color backgroundColor: "#ececec" property color highlightColor: "#91c4e1" + property color highlightTextColor: "#333333" } \ No newline at end of file diff --git a/qt-mobile/theme/Units.qml b/qt-mobile/theme/Units.qml index 73ee3f8cf..6b477b089 100644 --- a/qt-mobile/theme/Units.qml +++ b/qt-mobile/theme/Units.qml @@ -2,4 +2,5 @@ import QtQuick 2.3 QtObject { property int gridUnit: 24 + property int spacing: gridUnit / 3 } \ No newline at end of file