From 7b971c28e6098b629b8e9e3e38a9465a3f1bd459 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 8 Apr 2015 18:16:13 +0200 Subject: Rename Style to Theme Change-Id: I0186cd36f0b42ca015b70a09af27f8a3517d4a60 Reviewed-by: Jari-Pekka Nurmi --- examples/quick/calendar/main.qml | 12 +- examples/quick/controls/controls.pro | 2 +- examples/quick/controls/drawer/main.qml | 16 +-- examples/quick/controls/mirroring/main.qml | 10 +- examples/quick/controls/styles/main.cpp | 50 -------- examples/quick/controls/styles/main.qml | 188 ----------------------------- examples/quick/controls/styles/styles.pro | 12 -- examples/quick/controls/styles/styles.qrc | 5 - examples/quick/controls/tabs/main.qml | 62 +++++----- examples/quick/controls/theme/main.cpp | 50 ++++++++ examples/quick/controls/theme/main.qml | 188 +++++++++++++++++++++++++++++ examples/quick/controls/theme/theme.pro | 12 ++ examples/quick/controls/theme/theme.qrc | 5 + 13 files changed, 306 insertions(+), 306 deletions(-) delete mode 100644 examples/quick/controls/styles/main.cpp delete mode 100644 examples/quick/controls/styles/main.qml delete mode 100644 examples/quick/controls/styles/styles.pro delete mode 100644 examples/quick/controls/styles/styles.qrc create mode 100644 examples/quick/controls/theme/main.cpp create mode 100644 examples/quick/controls/theme/main.qml create mode 100644 examples/quick/controls/theme/theme.pro create mode 100644 examples/quick/controls/theme/theme.qrc (limited to 'examples') diff --git a/examples/quick/calendar/main.qml b/examples/quick/calendar/main.qml index 645b05dd..82d71ecb 100644 --- a/examples/quick/calendar/main.qml +++ b/examples/quick/calendar/main.qml @@ -99,7 +99,7 @@ ApplicationWindow { id: title x: delegate.contentItem.x width: delegate.contentItem.width - spacing: Style.spacing + spacing: Theme.spacing Text { width: parent.width height: implicitHeight * 2 @@ -129,7 +129,7 @@ ApplicationWindow { width: delegate.contentItem.width / 7 height: delegate.contentItem.height / 6 opacity: model.month === delegate.month ? 1 : 0 - color: model.today ? Style.accentColor : Style.textColor + color: model.today ? Theme.accentColor : Theme.textColor Rectangle { z: -1 anchors.centerIn: parent @@ -137,8 +137,8 @@ ApplicationWindow { height: width radius: width / 2 opacity: 0.5 - color: pressed ? Style.pressColor : "transparent" - border.color: eventModel.eventsForDate(model.date).length > 0 ? Style.accentColor : "transparent" + color: pressed ? Theme.pressColor : "transparent" + border.color: eventModel.eventsForDate(model.date).length > 0 ? Theme.accentColor : "transparent" } } } @@ -146,7 +146,7 @@ ApplicationWindow { z: -1 parent: calendar anchors.fill: parent - border.color: Style.frameColor + border.color: Theme.frameColor } } @@ -185,7 +185,7 @@ ApplicationWindow { Rectangle { width: (parent.width > parent.height ? (parent.width - parent.spacing) * 0.4 : parent.width) height: (parent.height > parent.width ? (parent.height - parent.spacing) * 0.4 : parent.height) - border.color: Style.frameColor + border.color: Theme.frameColor ListView { id: eventsListView diff --git a/examples/quick/controls/controls.pro b/examples/quick/controls/controls.pro index b39b9aea..37087c42 100644 --- a/examples/quick/controls/controls.pro +++ b/examples/quick/controls/controls.pro @@ -2,5 +2,5 @@ TEMPLATE = subdirs SUBDIRS += \ drawer \ mirroring \ - styles \ + theme \ tabs diff --git a/examples/quick/controls/drawer/main.qml b/examples/quick/controls/drawer/main.qml index 8ab67829..55385a6a 100644 --- a/examples/quick/controls/drawer/main.qml +++ b/examples/quick/controls/drawer/main.qml @@ -53,7 +53,7 @@ ApplicationWindow { id: content anchors.fill: parent anchors.margins: -1 - border.color: Style.frameColor + border.color: Theme.frameColor Image { width: window.width / 2 @@ -98,13 +98,13 @@ ApplicationWindow { model: VisualItemModel { Label { text: "Settings" - x: Style.padding - width: parent.width - Style.padding * 2 + x: Theme.padding + width: parent.width - Theme.padding * 2 lineHeight: 2.0 - color: Style.accentColor + color: Theme.accentColor verticalAlignment: Text.AlignVCenter } - Rectangle { width: parent.width; height: 1; color: Style.frameColor } + Rectangle { width: parent.width; height: 1; color: Theme.frameColor } Switch { id: dim text: "Dim" @@ -113,7 +113,7 @@ ApplicationWindow { layoutDirection: Qt.RightToLeft enabled: effect.current != uncover } - Rectangle { width: parent.width; height: 1; color: Style.frameColor } + Rectangle { width: parent.width; height: 1; color: Theme.frameColor } RadioButton { id: overlay text: "Overlay" @@ -136,14 +136,14 @@ ApplicationWindow { Exclusive.group: effect layoutDirection: Qt.RightToLeft } - Rectangle { width: parent.width; height: 1; color: Style.frameColor } + Rectangle { width: parent.width; height: 1; color: Theme.frameColor } } Rectangle { z: -1 anchors.fill: parent anchors.topMargin: -1 anchors.bottomMargin: -1 - border.color: Style.frameColor + border.color: Theme.frameColor } transform: Translate { diff --git a/examples/quick/controls/mirroring/main.qml b/examples/quick/controls/mirroring/main.qml index 1bdf8cb2..3deb3cae 100644 --- a/examples/quick/controls/mirroring/main.qml +++ b/examples/quick/controls/mirroring/main.qml @@ -67,7 +67,7 @@ ApplicationWindow { Label { id: label text: "Beyond the essentials." - color: Style.accentColor + color: Theme.accentColor anchors.fill: parent anchors.margins: 48 horizontalAlignment: Text.AlignHCenter @@ -89,7 +89,7 @@ ApplicationWindow { width: parent.width height: 1 anchors.bottom: parent.bottom - color: Style.frameColor + color: Theme.frameColor } } @@ -157,7 +157,7 @@ ApplicationWindow { width: flow.width Row { width: parent.width - spacing: Style.spacing + spacing: Theme.spacing readonly property real availableWidth: (flow.width - 12) / 2 readonly property real contentWidth: okButton.implicitWidth + cancelButton.implicitWidth + 12 readonly property real buttonWidth: contentWidth > availableWidth ? (width / 2 - spacing) : (width / 2 - 2 * spacing) / 2 @@ -196,7 +196,7 @@ ApplicationWindow { width: flow.width Column { width: parent.width - spacing: Style.spacing + spacing: Theme.spacing ProgressBar { width: parent.width indeterminate: true @@ -213,7 +213,7 @@ ApplicationWindow { width: flow.width Column { width: parent.width - spacing: Style.spacing + spacing: Theme.spacing Slider { id: slider value: 0.4 diff --git a/examples/quick/controls/styles/main.cpp b/examples/quick/controls/styles/main.cpp deleted file mode 100644 index 92844360..00000000 --- a/examples/quick/controls/styles/main.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -int main(int argc, char *argv[]) -{ - QGuiApplication app(argc, argv); - QQmlApplicationEngine engine; - engine.load(QUrl("qrc:/main.qml")); - return app.exec(); -} diff --git a/examples/quick/controls/styles/main.qml b/examples/quick/controls/styles/main.qml deleted file mode 100644 index c614320d..00000000 --- a/examples/quick/controls/styles/main.qml +++ /dev/null @@ -1,188 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -ApplicationWindow { - id: window - width: 360 - height: 520 - visible: true - title: "Qt Quick Controls - Styles Example" - - header: ToolBar { - ToolButton { - label: Text { - text: "\u25C0" - color: enabled ? Style.accentColor : Style.frameColor - anchors.centerIn: parent - } - enabled: stackview.depth > 1 - onClicked: stackview.pop() - } - } - - StackView { - id: stackview - anchors.fill: parent - initialItem: pageComponent - } - - Component { - id: pageComponent - Control { - id: page - Style.roundness: roundedToggle.checked ? 3 : 0 - Style.accentColor: Qt.hsla(colorSlider.position, 0.5, 0.5, 1.0) - Style.backgroundColor: darkButton.checked ? "#444" : "#fff" - Style.frameColor: darkButton.checked ? "#666" : "#ccc" - Style.textColor: darkButton.checked ? "#eee" : "#111" - Style.pressColor: darkButton.checked ? "#33ffffff" : "#33333333" - Style.baseColor: darkButton.checked ? "#444" : "#eee" - background: Rectangle { - color: Style.backgroundColor - } - Flickable { - anchors.fill: parent - contentHeight: column.height + 48 - - Column { - id: column - - x: (window.width - width) / 2 - y: 24 - width: window.width / 2 - spacing: 12 - - Label { - text: "Code less. Create more." - color: Style.accentColor - width: parent.width - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - wrapMode: Text.WordWrap - font.pointSize: 26 - } - - Item { width: 1; height: 48 } - - Rectangle { - width: parent.width - height: 1 - color: Style.frameColor - } - - Column { - spacing: 6 - width: parent.width - Label { - text: "Accent color" - color: Style.textColor - } - Slider { - id: colorSlider - width: parent.width - value: 0.275 - } - } - - Rectangle { - width: parent.width - height: 1 - color: Style.frameColor - } - - ExclusiveGroup { - id: styleGroup - } - - Column { - width: parent.width - spacing: 6 - RadioButton { - id: lightButton - text: "Light" - width: parent.width - checked: true - layoutDirection: Qt.RightToLeft - Exclusive.group: styleGroup - } - RadioButton { - id: darkButton - text: "Dark" - width: parent.width - layoutDirection: Qt.RightToLeft - Exclusive.group: styleGroup - } - } - - Rectangle { - width: parent.width - height: 1 - color: Style.frameColor - } - - ToggleButton { - id: roundedToggle - width: parent.width - text: "Rounded corners" - layoutDirection: Qt.RightToLeft - checked: true - } - - Rectangle { - width: parent.width - height: 1 - color: Style.frameColor - } - - Button { - text: "Push" - anchors.right: parent.right - onClicked: stackview.push(pageComponent) - } - } - - AbstractScrollIndicator.vertical: ScrollIndicator { } - } - } - } -} diff --git a/examples/quick/controls/styles/styles.pro b/examples/quick/controls/styles/styles.pro deleted file mode 100644 index f8fdec46..00000000 --- a/examples/quick/controls/styles/styles.pro +++ /dev/null @@ -1,12 +0,0 @@ -TEMPLATE = app -TARGET = styles -QT += quick - -SOURCES += \ - main.cpp - -OTHER_FILES += \ - main.qml - -RESOURCES += \ - styles.qrc diff --git a/examples/quick/controls/styles/styles.qrc b/examples/quick/controls/styles/styles.qrc deleted file mode 100644 index 5f6483ac..00000000 --- a/examples/quick/controls/styles/styles.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - main.qml - - diff --git a/examples/quick/controls/tabs/main.qml b/examples/quick/controls/tabs/main.qml index 38db6e87..5e68d79b 100644 --- a/examples/quick/controls/tabs/main.qml +++ b/examples/quick/controls/tabs/main.qml @@ -55,7 +55,7 @@ ApplicationWindow { spacing: 1 anchors.fill: parent - background: Rectangle { color: Style.frameColor } + background: Rectangle { color: Theme.frameColor } Rectangle { Tab.title: "Home" @@ -72,7 +72,7 @@ ApplicationWindow { Label { text: "Things just got better" - color: Style.accentColor + color: Theme.accentColor anchors.margins: 40 anchors.top: logo.bottom anchors.left: parent.left @@ -110,46 +110,46 @@ ApplicationWindow { Column { id: feedItem width: parent.width - spacing: Style.spacing + spacing: Theme.spacing Rectangle { width: parent.width height: 1 - color: Style.frameColor + color: Theme.frameColor visible: index == 0 } - Item { width: 1; height: Style.spacing } + Item { width: 1; height: Theme.spacing } Label { text: model.title - x: Style.padding - width: parent.width - 2 * Style.padding + x: Theme.padding + width: parent.width - 2 * Theme.padding elide: Text.ElideRight - color: Style.accentColor + color: Theme.accentColor font.pointSize: 20 lineHeight: 0.75 } Label { text: model.description textFormat: Text.StyledText - x: Style.padding - width: parent.width - 2 * Style.padding + x: Theme.padding + width: parent.width - 2 * Theme.padding wrapMode: Text.WordWrap } RowLayout { - x: Style.padding - width: parent.width - 2 * Style.padding - spacing: Style.spacing + x: Theme.padding + width: parent.width - 2 * Theme.padding + spacing: Theme.spacing Label { text: model.creator height: parent.height verticalAlignment: Text.AlignVCenter - color: Style.focusColor + color: Theme.focusColor font.pointSize: 8 } Label { text: model.pubDate height: parent.height verticalAlignment: Text.AlignVCenter - opacity: Style.disabledOpacity + opacity: Theme.disabledOpacity font.pointSize: 8 } Item { Layout.fillWidth: true } @@ -161,7 +161,7 @@ ApplicationWindow { Rectangle { width: parent.width height: 1 - color: Style.frameColor + color: Theme.frameColor } } } @@ -200,47 +200,47 @@ ApplicationWindow { Column { id: commentItem width: parent.width - spacing: Style.spacing + spacing: Theme.spacing Rectangle { width: parent.width height: 1 - color: Style.frameColor + color: Theme.frameColor visible: index == 0 } - Item { width: 1; height: Style.spacing } + Item { width: 1; height: Theme.spacing } Label { text: model.title - x: Style.padding - width: parent.width - 2 * Style.padding + x: Theme.padding + width: parent.width - 2 * Theme.padding elide: Text.ElideRight - color: Style.accentColor + color: Theme.accentColor font.pointSize: 14 lineHeight: 0.75 } - Item { width: 1; height: Style.spacing } + Item { width: 1; height: Theme.spacing } Label { text: model.description textFormat: Text.StyledText - x: Style.padding - width: parent.width - 2 * Style.padding + x: Theme.padding + width: parent.width - 2 * Theme.padding wrapMode: Text.WordWrap } RowLayout { - x: Style.padding - width: parent.width - 2 * Style.padding - spacing: Style.spacing + x: Theme.padding + width: parent.width - 2 * Theme.padding + spacing: Theme.spacing Label { text: model.creator height: parent.height verticalAlignment: Text.AlignVCenter - color: Style.focusColor + color: Theme.focusColor font.pointSize: 8 } Label { text: model.pubDate height: parent.height verticalAlignment: Text.AlignVCenter - opacity: Style.disabledOpacity + opacity: Theme.disabledOpacity font.pointSize: 8 } Item { Layout.fillWidth: true } @@ -252,7 +252,7 @@ ApplicationWindow { Rectangle { width: parent.width height: 1 - color: Style.frameColor + color: Theme.frameColor } } } diff --git a/examples/quick/controls/theme/main.cpp b/examples/quick/controls/theme/main.cpp new file mode 100644 index 00000000..92844360 --- /dev/null +++ b/examples/quick/controls/theme/main.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + QQmlApplicationEngine engine; + engine.load(QUrl("qrc:/main.qml")); + return app.exec(); +} diff --git a/examples/quick/controls/theme/main.qml b/examples/quick/controls/theme/main.qml new file mode 100644 index 00000000..58f5b5f9 --- /dev/null +++ b/examples/quick/controls/theme/main.qml @@ -0,0 +1,188 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +ApplicationWindow { + id: window + width: 360 + height: 520 + visible: true + title: "Qt Quick Controls - Theme Example" + + header: ToolBar { + ToolButton { + label: Text { + text: "\u25C0" + color: enabled ? Theme.accentColor : Theme.frameColor + anchors.centerIn: parent + } + enabled: stackview.depth > 1 + onClicked: stackview.pop() + } + } + + StackView { + id: stackview + anchors.fill: parent + initialItem: pageComponent + } + + Component { + id: pageComponent + Control { + id: page + Theme.roundness: roundedToggle.checked ? 3 : 0 + Theme.accentColor: Qt.hsla(colorSlider.position, 0.5, 0.5, 1.0) + Theme.backgroundColor: darkButton.checked ? "#444" : "#fff" + Theme.frameColor: darkButton.checked ? "#666" : "#ccc" + Theme.textColor: darkButton.checked ? "#eee" : "#111" + Theme.pressColor: darkButton.checked ? "#33ffffff" : "#33333333" + Theme.baseColor: darkButton.checked ? "#444" : "#eee" + background: Rectangle { + color: Theme.backgroundColor + } + Flickable { + anchors.fill: parent + contentHeight: column.height + 48 + + Column { + id: column + + x: (window.width - width) / 2 + y: 24 + width: window.width / 2 + spacing: 12 + + Label { + text: "Code less. Create more." + color: Theme.accentColor + width: parent.width + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + wrapMode: Text.WordWrap + font.pointSize: 26 + } + + Item { width: 1; height: 48 } + + Rectangle { + width: parent.width + height: 1 + color: Theme.frameColor + } + + Column { + spacing: 6 + width: parent.width + Label { + text: "Accent color" + color: Theme.textColor + } + Slider { + id: colorSlider + width: parent.width + value: 0.275 + } + } + + Rectangle { + width: parent.width + height: 1 + color: Theme.frameColor + } + + ExclusiveGroup { + id: themeGroup + } + + Column { + width: parent.width + spacing: 6 + RadioButton { + id: lightButton + text: "Light" + width: parent.width + checked: true + layoutDirection: Qt.RightToLeft + Exclusive.group: themeGroup + } + RadioButton { + id: darkButton + text: "Dark" + width: parent.width + layoutDirection: Qt.RightToLeft + Exclusive.group: themeGroup + } + } + + Rectangle { + width: parent.width + height: 1 + color: Theme.frameColor + } + + ToggleButton { + id: roundedToggle + width: parent.width + text: "Rounded corners" + layoutDirection: Qt.RightToLeft + checked: true + } + + Rectangle { + width: parent.width + height: 1 + color: Theme.frameColor + } + + Button { + text: "Push" + anchors.right: parent.right + onClicked: stackview.push(pageComponent) + } + } + + AbstractScrollIndicator.vertical: ScrollIndicator { } + } + } + } +} diff --git a/examples/quick/controls/theme/theme.pro b/examples/quick/controls/theme/theme.pro new file mode 100644 index 00000000..0208bd4f --- /dev/null +++ b/examples/quick/controls/theme/theme.pro @@ -0,0 +1,12 @@ +TEMPLATE = app +TARGET = theme +QT += quick + +SOURCES += \ + main.cpp + +OTHER_FILES += \ + main.qml + +RESOURCES += \ + theme.qrc diff --git a/examples/quick/controls/theme/theme.qrc b/examples/quick/controls/theme/theme.qrc new file mode 100644 index 00000000..5f6483ac --- /dev/null +++ b/examples/quick/controls/theme/theme.qrc @@ -0,0 +1,5 @@ + + + main.qml + + -- cgit v1.2.3