From 2bdf059e6e62fda8e1df108f0a68651e546b0f67 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 8 Sep 2016 10:29:57 +0200 Subject: Default: consolidate style colors into a singleton This reduces all of the duplicate literals that we currently have. Task-number: QTBUG-55867 Change-Id: I28f1f646d25f2f6578d52b4ba96f8f0f3ad6706b Reviewed-by: J-P Nurmi --- src/imports/controls/ApplicationWindow.qml | 8 +- src/imports/controls/Button.qml | 12 +- src/imports/controls/CheckBox.qml | 2 +- src/imports/controls/CheckDelegate.qml | 4 +- src/imports/controls/CheckIndicator.qml | 14 +- src/imports/controls/ComboBox.qml | 13 +- src/imports/controls/Dial.qml | 4 +- src/imports/controls/Dialog.qml | 3 +- src/imports/controls/Drawer.qml | 4 +- src/imports/controls/Frame.qml | 4 +- src/imports/controls/GroupBox.qml | 6 +- src/imports/controls/ItemDelegate.qml | 8 +- src/imports/controls/Label.qml | 6 +- src/imports/controls/Menu.qml | 5 +- src/imports/controls/MenuItem.qml | 6 +- src/imports/controls/MenuSeparator.qml | 4 +- src/imports/controls/Page.qml | 4 +- src/imports/controls/PageIndicator.qml | 4 +- src/imports/controls/Pane.qml | 4 +- src/imports/controls/Popup.qml | 4 +- src/imports/controls/ProgressBar.qml | 2 +- src/imports/controls/RadioButton.qml | 2 +- src/imports/controls/RadioDelegate.qml | 4 +- src/imports/controls/RadioIndicator.qml | 10 +- src/imports/controls/RangeSlider.qml | 20 +- src/imports/controls/RoundButton.qml | 10 +- src/imports/controls/ScrollBar.qml | 4 +- src/imports/controls/ScrollIndicator.qml | 4 +- src/imports/controls/Slider.qml | 12 +- src/imports/controls/SpinBox.qml | 22 ++- src/imports/controls/SwipeDelegate.qml | 8 +- src/imports/controls/Switch.qml | 2 +- src/imports/controls/SwitchDelegate.qml | 4 +- src/imports/controls/SwitchIndicator.qml | 14 +- src/imports/controls/TabButton.qml | 8 +- src/imports/controls/TextArea.qml | 8 +- src/imports/controls/TextField.qml | 12 +- src/imports/controls/ToolBar.qml | 4 +- src/imports/controls/ToolButton.qml | 6 +- src/imports/controls/ToolSeparator.qml | 4 +- src/imports/controls/ToolTip.qml | 3 +- src/imports/controls/Tumbler.qml | 2 +- src/imports/controls/controls.pri | 6 +- src/imports/controls/qquickdefaultstyle.cpp | 241 ++++++++++++++++++++++++ src/imports/controls/qquickdefaultstyle_p.h | 145 ++++++++++++++ src/imports/controls/qtquickcontrols2plugin.cpp | 9 + 46 files changed, 587 insertions(+), 98 deletions(-) create mode 100644 src/imports/controls/qquickdefaultstyle.cpp create mode 100644 src/imports/controls/qquickdefaultstyle_p.h (limited to 'src/imports/controls') diff --git a/src/imports/controls/ApplicationWindow.qml b/src/imports/controls/ApplicationWindow.qml index 14a0b508..32065f02 100644 --- a/src/imports/controls/ApplicationWindow.qml +++ b/src/imports/controls/ApplicationWindow.qml @@ -35,19 +35,21 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Window 2.2 import QtQuick.Templates 2.1 as T T.ApplicationWindow { id: window - color: "#ffffff" + color: Default.backgroundColor overlay.modal: Rectangle { - color: "#7f28282a" + color: Default.overlayModalColor } overlay.modeless: Rectangle { - color: "#1f28282a" + color: Default.overlayDimColor } } diff --git a/src/imports/controls/Button.qml b/src/imports/controls/Button.qml index 3b55089c..af2e0aea 100644 --- a/src/imports/controls/Button.qml +++ b/src/imports/controls/Button.qml @@ -35,6 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Templates 2.1 as T T.Button { @@ -55,7 +57,9 @@ T.Button { text: control.text font: control.font opacity: enabled || control.highlighted || control.checked ? 1 : 0.3 - color: control.checked || control.highlighted ? "#ffffff" : (control.visualFocus ? "#0066ff" : (control.down ? "#26282a" : "#353637")) + color: control.checked || control.highlighted ? + Default.textLightColor : + (control.visualFocus ? Default.focusColor : (control.down ? Default.textDarkColor : Default.textColor)) horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter elide: Text.ElideRight @@ -69,9 +73,9 @@ T.Button { opacity: enabled ? 1 : 0.3 visible: !control.flat || control.down || control.checked || control.highlighted color: control.checked || control.highlighted ? - (control.visualFocus ? (control.down ? "#599bff" : "#0066ff") : (control.down ? "#585a5c" : "#353637")) : - (control.visualFocus ? (control.down ? "#cce0ff" : "#f0f6ff") : (control.down ? "#d0d0d0" : "#e0e0e0")) - border.color: "#0066ff" + (control.visualFocus ? (control.down ? Default.buttonCheckedFocusColor : Default.focusColor) : (control.down ? Default.buttonCheckedPressedColor : Default.textColor)) : + (control.visualFocus ? (control.down ? Default.focusPressedColor : Default.focusLightColor) : (control.down ? Default.buttonPressedColor : Default.buttonColor)) + border.color: Default.focusColor border.width: control.visualFocus ? 2 : 0 } //! [background] diff --git a/src/imports/controls/CheckBox.qml b/src/imports/controls/CheckBox.qml index bc837434..690aeff2 100644 --- a/src/imports/controls/CheckBox.qml +++ b/src/imports/controls/CheckBox.qml @@ -68,7 +68,7 @@ T.CheckBox { text: control.text font: control.font - color: control.down ? "#26282a" : "#353637" + color: control.down ? Default.textDarkColor : Default.textColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft diff --git a/src/imports/controls/CheckDelegate.qml b/src/imports/controls/CheckDelegate.qml index e951ff6f..f980690f 100644 --- a/src/imports/controls/CheckDelegate.qml +++ b/src/imports/controls/CheckDelegate.qml @@ -59,7 +59,7 @@ T.CheckDelegate { text: control.text font: control.font - color: control.enabled ? "#26282a" : "#bdbebf" + color: control.enabled ? Default.textDarkColor : Default.textDisabledColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft @@ -81,7 +81,7 @@ T.CheckDelegate { implicitWidth: 100 implicitHeight: 40 visible: control.down || control.highlighted - color: control.down ? "#bdbebf" : "#eeeeee" + color: control.down ? Default.delegatePressedColor : Default.delegateColor } //! [background] } diff --git a/src/imports/controls/CheckIndicator.qml b/src/imports/controls/CheckIndicator.qml index d78e9e30..7f3e7e6f 100644 --- a/src/imports/controls/CheckIndicator.qml +++ b/src/imports/controls/CheckIndicator.qml @@ -35,6 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 Rectangle { id: indicator @@ -44,14 +46,18 @@ Rectangle { implicitWidth: 28 implicitHeight: 28 - color: control.enabled ? (control.down ? (control.visualFocus ? "#cce0ff" : "#f6f6f6") : "#ffffff") : "#353637" + color: control.enabled ? (control.down + ? (control.visualFocus ? Default.focusPressedColor : Default.indicatorPressedColor) + : Default.backgroundColor) : Default.disabledDarkColor border.width: control.visualFocus ? 2 : 1 - border.color: control.enabled ? (control.visualFocus ? "#0066ff" : (control.down ? "#808080" : "#909090")) : "transparent" + border.color: control.enabled ? (control.visualFocus + ? Default.focusColor + : (control.down ? Default.indicatorFramePressedColor : Default.indicatorFrameColor)) : "transparent" Image { x: (parent.width - width) / 2 y: (parent.height - height) / 2 - source: "image://default/check/" + (control.visualFocus ? "#0066ff" : "#353637") + source: "image://default/check/" + (control.visualFocus ? Default.focusColor : Default.textColor) sourceSize.width: width sourceSize.height: height visible: control.checkState === Qt.Checked @@ -62,7 +68,7 @@ Rectangle { y: (parent.height - height) / 2 width: 16 height: 3 - color: control.visualFocus ? "#0066ff" : "#353637" + color: control.visualFocus ? Default.focusColor : Default.frameDarkColor visible: control.checkState === Qt.PartiallyChecked } } diff --git a/src/imports/controls/ComboBox.qml b/src/imports/controls/ComboBox.qml index aeeabbb7..89c59beb 100644 --- a/src/imports/controls/ComboBox.qml +++ b/src/imports/controls/ComboBox.qml @@ -37,6 +37,7 @@ import QtQuick 2.6 import QtQuick.Window 2.2 import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Templates 2.1 as T T.ComboBox { @@ -70,7 +71,7 @@ T.ComboBox { indicator: Image { x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding y: control.topPadding + (control.availableHeight - height) / 2 - source: "image://default/double-arrow/" + (control.visualFocus ? "#0066ff" : "#353637") + source: "image://default/double-arrow/" + (control.visualFocus ? Default.focusColor : Default.textColor) sourceSize.width: width sourceSize.height: height } @@ -83,7 +84,7 @@ T.ComboBox { text: control.displayText font: control.font - color: control.visualFocus ? "#0066ff" : "#353637" + color: control.visualFocus ? Default.focusColor : Default.textColor horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter elide: Text.ElideRight @@ -95,9 +96,9 @@ T.ComboBox { implicitWidth: 120 implicitHeight: 40 - color: control.visualFocus ? (control.pressed ? "#cce0ff" : "#f0f6ff") : - (control.pressed || popup.visible ? "#d0d0d0" : "#e0e0e0") - border.color: "#0066ff" + color: control.visualFocus ? (control.pressed ? Default.focusPressedColor : Default.focusLightColor) : + (control.pressed || popup.visible ? Default.buttonPressedColor : Default.buttonColor) + border.color: Default.focusColor border.width: control.visualFocus ? 2 : 0 visible: !control.flat || control.pressed } @@ -123,7 +124,7 @@ T.ComboBox { width: listview.width height: listview.height color: "transparent" - border.color: "#bdbebf" + border.color: Default.frameLightColor } T.ScrollIndicator.vertical: ScrollIndicator { } diff --git a/src/imports/controls/Dial.qml b/src/imports/controls/Dial.qml index 87c44b38..cc202772 100644 --- a/src/imports/controls/Dial.qml +++ b/src/imports/controls/Dial.qml @@ -49,7 +49,7 @@ T.Dial { background: DialRing { width: control.availableWidth height: control.availableHeight - color: control.visualFocus ? "#0066ff" : "#353637" + color: control.visualFocus ? Default.focusColor : Default.frameDarkColor progress: control.position opacity: control.enabled ? 1 : 0.3 } @@ -62,7 +62,7 @@ T.Dial { y: background.y + background.height / 2 - handle.height / 2 width: 14 height: 10 - source: "image://default/dial-indicator/" + (control.visualFocus ? "#0066ff" : "#353637") + source: "image://default/dial-indicator/" + (control.visualFocus ? Default.focusColor : Default.textColor) sourceSize.width: width sourceSize.height: height antialiasing: true diff --git a/src/imports/controls/Dialog.qml b/src/imports/controls/Dialog.qml index 79130a26..18760d3f 100644 --- a/src/imports/controls/Dialog.qml +++ b/src/imports/controls/Dialog.qml @@ -37,6 +37,7 @@ import QtQuick 2.6 import QtQuick.Templates 2.1 as T import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 T.Dialog { id: control @@ -57,7 +58,7 @@ T.Dialog { contentItem: Item { } background: Rectangle { - border.color: "#353637" + border.color: Default.frameDarkColor } buttonBox: DialogButtonBox { diff --git a/src/imports/controls/Drawer.qml b/src/imports/controls/Drawer.qml index 6abd40e4..4b4ea8c0 100644 --- a/src/imports/controls/Drawer.qml +++ b/src/imports/controls/Drawer.qml @@ -35,6 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Templates 2.1 as T T.Drawer { @@ -69,7 +71,7 @@ T.Drawer { readonly property bool horizontal: control.edge === Qt.LeftEdge || control.edge === Qt.RightEdge width: horizontal ? 1 : parent.width height: horizontal ? parent.height : 1 - color: "#353637" + color: Default.frameDarkColor x: control.edge === Qt.LeftEdge ? parent.width - 1 : 0 y: control.edge === Qt.TopEdge ? parent.height - 1 : 0 } diff --git a/src/imports/controls/Frame.qml b/src/imports/controls/Frame.qml index aee658f4..e1148496 100644 --- a/src/imports/controls/Frame.qml +++ b/src/imports/controls/Frame.qml @@ -35,6 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Templates 2.1 as T T.Frame { @@ -55,7 +57,7 @@ T.Frame { //! [background] background: Rectangle { color: "transparent" - border.color: "#bdbebf" + border.color: Default.frameLightColor } //! [background] } diff --git a/src/imports/controls/GroupBox.qml b/src/imports/controls/GroupBox.qml index 3e9cdad6..7a20225d 100644 --- a/src/imports/controls/GroupBox.qml +++ b/src/imports/controls/GroupBox.qml @@ -35,6 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Templates 2.1 as T T.GroupBox { @@ -63,7 +65,7 @@ T.GroupBox { text: control.title font: control.font - color: control.enabled ? "#353637" : "#bdbebf" + color: control.enabled ? Default.textColor : Default.textDisabledColor elide: Text.ElideRight horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter @@ -77,7 +79,7 @@ T.GroupBox { height: parent.height - control.topPadding + control.padding color: "transparent" - border.color: "#bdbebf" + border.color: Default.frameLightColor } //! [background] } diff --git a/src/imports/controls/ItemDelegate.qml b/src/imports/controls/ItemDelegate.qml index 7ef41723..98b6c617 100644 --- a/src/imports/controls/ItemDelegate.qml +++ b/src/imports/controls/ItemDelegate.qml @@ -35,6 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Templates 2.1 as T T.ItemDelegate { @@ -57,7 +59,7 @@ T.ItemDelegate { text: control.text font: control.font - color: control.enabled ? "#26282a" : "#bdbebf" + color: control.enabled ? Default.textDarkColor : Default.textDisabledColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft @@ -70,7 +72,9 @@ T.ItemDelegate { implicitWidth: 100 implicitHeight: 40 visible: control.down || control.highlighted || control.visualFocus - color: control.visualFocus ? (control.pressed ? "#cce0ff" : "#e5efff") : (control.down ? "#bdbebf" : "#eeeeee") + color: control.visualFocus + ? (control.pressed ? Default.focusPressedColor : Default.delegateFocusColor) + : (control.down ? Default.delegatePressedColor : Default.delegateColor) } //! [background] } diff --git a/src/imports/controls/Label.qml b/src/imports/controls/Label.qml index 5c3de5de..a3b8d1f9 100644 --- a/src/imports/controls/Label.qml +++ b/src/imports/controls/Label.qml @@ -35,11 +35,13 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Templates 2.1 as T T.Label { id: control - color: "#26282a" - linkColor: "#45a7d7" // TODO + color: Default.textDarkColor + linkColor: Default.textLinkColor } diff --git a/src/imports/controls/Menu.qml b/src/imports/controls/Menu.qml index 8fe9155e..9f5bb517 100644 --- a/src/imports/controls/Menu.qml +++ b/src/imports/controls/Menu.qml @@ -36,6 +36,7 @@ import QtQuick 2.6 import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Templates 2.1 as T T.Menu { @@ -66,8 +67,8 @@ T.Menu { background: Rectangle { implicitWidth: 200 implicitHeight: 40 - color: "#ffffff" - border.color: "#353637" + color: Default.backgroundColor + border.color: Default.frameDarkColor } //! [background] } diff --git a/src/imports/controls/MenuItem.qml b/src/imports/controls/MenuItem.qml index 9ee77685..f9c5ba88 100644 --- a/src/imports/controls/MenuItem.qml +++ b/src/imports/controls/MenuItem.qml @@ -35,6 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Templates 2.1 as T T.MenuItem { @@ -56,7 +58,7 @@ T.MenuItem { text: control.text font: control.font - color: control.enabled ? "#26282a" : "#bdbebf" + color: control.enabled ? Default.textDarkColor : Default.textDisabledColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft @@ -84,7 +86,7 @@ T.MenuItem { y: 1 width: parent.width - 2 height: parent.height - 2 - color: control.visualFocus || control.down ? "#eeeeee" : "transparent" + color: control.visualFocus || control.down ? Default.delegateColor : "transparent" } } //! [background] diff --git a/src/imports/controls/MenuSeparator.qml b/src/imports/controls/MenuSeparator.qml index f74047bb..0038109f 100644 --- a/src/imports/controls/MenuSeparator.qml +++ b/src/imports/controls/MenuSeparator.qml @@ -35,6 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Templates 2.1 as T T.MenuSeparator { @@ -51,7 +53,7 @@ T.MenuSeparator { contentItem: Rectangle { implicitWidth: 188 implicitHeight: 1 - color: "#ccc" + color: Default.separatorColor } //! [contentItem] } diff --git a/src/imports/controls/Page.qml b/src/imports/controls/Page.qml index 111d561c..1abb06a3 100644 --- a/src/imports/controls/Page.qml +++ b/src/imports/controls/Page.qml @@ -35,6 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Templates 2.1 as T T.Page { @@ -46,7 +48,7 @@ T.Page { //! [background] background: Rectangle { - color: "#ffffff" + color: Default.backgroundColor } //! [background] } diff --git a/src/imports/controls/PageIndicator.qml b/src/imports/controls/PageIndicator.qml index 86870db6..29c6231e 100644 --- a/src/imports/controls/PageIndicator.qml +++ b/src/imports/controls/PageIndicator.qml @@ -35,6 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Templates 2.1 as T T.PageIndicator { @@ -54,7 +56,7 @@ T.PageIndicator { implicitHeight: 8 radius: width / 2 - color: "#28282a" // TODO + color: Default.pageIndicatorColor opacity: index === currentIndex ? 0.95 : pressed ? 0.7 : 0.45 Behavior on opacity { OpacityAnimator { duration: 100 } } diff --git a/src/imports/controls/Pane.qml b/src/imports/controls/Pane.qml index 685cf24e..7066560a 100644 --- a/src/imports/controls/Pane.qml +++ b/src/imports/controls/Pane.qml @@ -35,6 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Templates 2.1 as T T.Pane { @@ -54,7 +56,7 @@ T.Pane { //! [background] background: Rectangle { - color: "#ffffff" + color: Default.backgroundColor } //! [background] } diff --git a/src/imports/controls/Popup.qml b/src/imports/controls/Popup.qml index b0015137..c9e9d60e 100644 --- a/src/imports/controls/Popup.qml +++ b/src/imports/controls/Popup.qml @@ -35,6 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Templates 2.1 as T T.Popup { @@ -53,6 +55,6 @@ T.Popup { contentItem: Item { } background: Rectangle { - border.color: "#353637" + border.color: Default.frameDarkColor } } diff --git a/src/imports/controls/ProgressBar.qml b/src/imports/controls/ProgressBar.qml index 31fc1bad..b09eae1e 100644 --- a/src/imports/controls/ProgressBar.qml +++ b/src/imports/controls/ProgressBar.qml @@ -72,7 +72,7 @@ T.ProgressBar { width: control.availableWidth height: 6 - color: "#e4e4e4" + color: Default.progressBarColor } //! [background] } diff --git a/src/imports/controls/RadioButton.qml b/src/imports/controls/RadioButton.qml index f6f256c1..119909ef 100644 --- a/src/imports/controls/RadioButton.qml +++ b/src/imports/controls/RadioButton.qml @@ -68,7 +68,7 @@ T.RadioButton { text: control.text font: control.font - color: control.down ? "#26282a" : "#353637" + color: control.down ? Default.textDarkColor : Default.textColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft diff --git a/src/imports/controls/RadioDelegate.qml b/src/imports/controls/RadioDelegate.qml index b2b82dd6..d156d9ee 100644 --- a/src/imports/controls/RadioDelegate.qml +++ b/src/imports/controls/RadioDelegate.qml @@ -59,7 +59,7 @@ T.RadioDelegate { text: control.text font: control.font - color: control.enabled ? "#26282a" : "#bdbebf" + color: control.enabled ? Default.textDarkColor : Default.textDisabledColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft @@ -81,7 +81,7 @@ T.RadioDelegate { implicitWidth: 100 implicitHeight: 40 visible: control.down || control.highlighted - color: control.down ? "#bdbebf" : "#eeeeee" + color: control.down ? Default.delegatePressedColor : Default.delegateColor } //! [background] } diff --git a/src/imports/controls/RadioIndicator.qml b/src/imports/controls/RadioIndicator.qml index 08c24cc5..7fb855d9 100644 --- a/src/imports/controls/RadioIndicator.qml +++ b/src/imports/controls/RadioIndicator.qml @@ -35,15 +35,19 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 Rectangle { implicitWidth: 28 implicitHeight: 28 radius: width / 2 - color: control.down ? (control.visualFocus ? "#cce0ff" : "#f6f6f6") : (control.visualFocus ? "#f0f6ff" : "#ffffff") + color: control.down + ? (control.visualFocus ? Default.focusPressedColor : Default.indicatorPressedColor) + : (control.visualFocus ? Default.focusLightColor : Default.backgroundColor) border.width: control.visualFocus ? 2 : 1 - border.color: control.visualFocus ? "#0066ff" : (control.down ? "#808080" : "#909090") + border.color: control.visualFocus ? Default.focusColor : (control.down ? Default.indicatorFramePressedColor : Default.indicatorFrameColor) property Item control @@ -53,7 +57,7 @@ Rectangle { width: 20 height: 20 radius: width / 2 - color: control.down ? "#26282a" : "#353637" + color: control.down ? Default.textDarkColor : Default.buttonCheckedColor visible: control.checked } } diff --git a/src/imports/controls/RangeSlider.qml b/src/imports/controls/RangeSlider.qml index a201d446..14d7e271 100644 --- a/src/imports/controls/RangeSlider.qml +++ b/src/imports/controls/RangeSlider.qml @@ -35,6 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Templates 2.1 as T T.RangeSlider { @@ -57,8 +59,12 @@ T.RangeSlider { implicitHeight: 28 radius: width / 2 border.width: activeFocus ? 2 : 1 - border.color: control.enabled ? (activeFocus ? "#0066ff" : (control.first.pressed ? "#808080" : "#909090")) : "#d6d6d6" - color: control.enabled ? (first.pressed ? (activeFocus ? "#cce0ff" : "#f6f6f6") : (activeFocus ? "#f0f6ff" : "#ffffff")) : "#fdfdfd" + border.color: control.enabled ? (activeFocus + ? Default.focusColor + : (control.first.pressed ? Default.indicatorFramePressedColor : Default.indicatorFrameColor)) : Default.indicatorFrameDisabledColor + color: control.enabled ? (first.pressed + ? (activeFocus ? Default.focusPressedColor : Default.indicatorPressedColor) + : (activeFocus ? Default.focusLightColor : Default.backgroundColor)) : Default.indicatorDisabledColor readonly property bool horizontal: control.orientation === Qt.Horizontal } @@ -72,8 +78,12 @@ T.RangeSlider { implicitHeight: 28 radius: width / 2 border.width: activeFocus ? 2 : 1 - border.color: control.enabled ? (activeFocus ? "#0066ff" : (control.first.pressed ? "#808080" : "#909090")) : "#d6d6d6" - color: control.enabled ? (second.pressed ? (activeFocus ? "#cce0ff" : "#f6f6f6") : (activeFocus ? "#f0f6ff" : "#ffffff")) : "#fdfdfd" + border.color: control.enabled ? (activeFocus + ? Default.focusColor + : (control.first.pressed ? Default.indicatorFramePressedColor : Default.indicatorFrameColor)) : Default.indicatorFrameDisabledColor + color: control.enabled ? (second.pressed + ? (activeFocus ? Default.focusPressedColor : Default.indicatorPressedColor) + : (activeFocus ? Default.focusLightColor : Default.backgroundColor)) : Default.indicatorDisabledColor readonly property bool horizontal: control.orientation === Qt.Horizontal } @@ -89,7 +99,7 @@ T.RangeSlider { height: horizontal ? implicitHeight : control.availableHeight radius: 3 opacity: control.enabled ? 1 : 0.3 - color: "#e0e0e0" + color: Default.buttonColor scale: horizontal && control.mirrored ? -1 : 1 readonly property bool horizontal: control.orientation === Qt.Horizontal diff --git a/src/imports/controls/RoundButton.qml b/src/imports/controls/RoundButton.qml index 102774e0..f0edb4e8 100644 --- a/src/imports/controls/RoundButton.qml +++ b/src/imports/controls/RoundButton.qml @@ -35,6 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Templates 2.1 as T T.RoundButton { @@ -53,7 +55,7 @@ T.RoundButton { text: control.text font: control.font opacity: enabled || control.highlighted || control.checked ? 1 : 0.3 - color: control.checked || control.highlighted ? "#ffffff" : (control.visualFocus ? "#0066ff" : (control.down ? "#26282a" : "#353637")) + color: control.checked || control.highlighted ? Default.textLightColor : (control.visualFocus ? Default.focusColor : (control.down ? Default.textDarkColor : Default.textColor)) horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter elide: Text.ElideRight @@ -68,9 +70,9 @@ T.RoundButton { opacity: enabled ? 1 : 0.3 visible: !control.flat || control.down || control.checked || control.highlighted color: control.checked || control.highlighted ? - (control.visualFocus ? (control.down ? "#599bff" : "#0066ff") : (control.down ? "#585a5c" : "#353637")) : - (control.visualFocus ? (control.down ? "#cce0ff" : "#f0f6ff") : (control.down ? "#d0d0d0" : "#e0e0e0")) - border.color: "#0066ff" + (control.visualFocus ? (control.down ? Default.buttonCheckedFocusColor : Default.focusColor) : (control.down ? Default.buttonCheckedPressedColor : Default.buttonCheckedColor)) : + (control.visualFocus ? (control.down ? Default.focusPressedColor : Default.focusLightColor) : (control.down ? Default.buttonPressedColor : Default.buttonColor)) + border.color: Default.focusColor border.width: control.visualFocus ? 2 : 0 } //! [background] diff --git a/src/imports/controls/ScrollBar.qml b/src/imports/controls/ScrollBar.qml index 46a5bc5b..6f4386f9 100644 --- a/src/imports/controls/ScrollBar.qml +++ b/src/imports/controls/ScrollBar.qml @@ -35,6 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Templates 2.1 as T T.ScrollBar { @@ -55,7 +57,7 @@ T.ScrollBar { implicitHeight: 6 radius: width / 2 - color: control.pressed ? "#28282a" : "#bdbebf" + color: control.pressed ? Default.scrollBarPressedColor : Default.scrollBarColor visible: control.size < 1.0 opacity: 0.0 diff --git a/src/imports/controls/ScrollIndicator.qml b/src/imports/controls/ScrollIndicator.qml index 702611c7..15a9822a 100644 --- a/src/imports/controls/ScrollIndicator.qml +++ b/src/imports/controls/ScrollIndicator.qml @@ -35,6 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Templates 2.1 as T T.ScrollIndicator { @@ -54,7 +56,7 @@ T.ScrollIndicator { implicitWidth: 2 implicitHeight: 2 - color: "#bdbebf" + color: Default.scrollBarColor visible: control.size < 1.0 opacity: 0.0 diff --git a/src/imports/controls/Slider.qml b/src/imports/controls/Slider.qml index 37eb618a..7c34cc9f 100644 --- a/src/imports/controls/Slider.qml +++ b/src/imports/controls/Slider.qml @@ -35,6 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Templates 2.1 as T T.Slider { @@ -54,9 +56,13 @@ T.Slider { implicitWidth: 28 implicitHeight: 28 radius: width / 2 - color: control.enabled ? (control.pressed ? (control.visualFocus ? "#cce0ff" : "#f6f6f6") : (control.visualFocus ? "#f0f6ff" : "#ffffff")) : "#fdfdfd" + color: control.enabled ? (control.pressed + ? (control.visualFocus ? Default.focusPressedColor : Default.indicatorPressedColor) + : (control.visualFocus ? Default.focusLightColor : Default.backgroundColor)) : Default.indicatorDisabledColor border.width: control.visualFocus ? 2 : 1 - border.color: control.enabled ? (control.visualFocus ? "#0066ff" : (control.pressed ? "#808080" : "#909090")) : "#d6d6d6" + border.color: control.enabled ? (control.visualFocus + ? Default.focusColor + : (control.pressed ? Default.indicatorFramePressedColor : Default.indicatorFrameColor)) : Default.indicatorFrameDisabledColor readonly property bool horizontal: control.orientation === Qt.Horizontal } @@ -72,7 +78,7 @@ T.Slider { height: horizontal ? implicitHeight : control.availableHeight radius: 3 opacity: control.enabled ? 1 : 0.3 - color: "#e0e0e0" + color: Default.buttonColor scale: horizontal && control.mirrored ? -1 : 1 readonly property bool horizontal: control.orientation === Qt.Horizontal diff --git a/src/imports/controls/SpinBox.qml b/src/imports/controls/SpinBox.qml index 20ca0d5d..e7c3dbf5 100644 --- a/src/imports/controls/SpinBox.qml +++ b/src/imports/controls/SpinBox.qml @@ -35,6 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Templates 2.1 as T T.SpinBox { @@ -69,9 +71,9 @@ T.SpinBox { opacity: control.enabled ? 1 : 0.3 font: control.font - color: "#353637" - selectionColor: "#0066ff" - selectedTextColor: "#ffffff" + color: Default.textColor + selectionColor: Default.focusColor + selectedTextColor: Default.textLightColor horizontalAlignment: Qt.AlignHCenter verticalAlignment: Qt.AlignVCenter @@ -86,7 +88,7 @@ T.SpinBox { height: control.height visible: control.activeFocus color: "transparent" - border.color: "#0066ff" + border.color: Default.focusColor border.width: 2 } } @@ -98,21 +100,21 @@ T.SpinBox { height: parent.height implicitWidth: 40 implicitHeight: 40 - color: up.pressed ? "#d0d0d0" : "#e0e0e0" + color: up.pressed ? Default.buttonPressedColor : Default.buttonColor Rectangle { x: (parent.width - width) / 2 y: (parent.height - height) / 2 width: parent.width / 3 height: 2 - color: enabled ? "#353637" : "#bdbebf" + color: enabled ? Default.textColor : Default.textDisabledColor } Rectangle { x: (parent.width - width) / 2 y: (parent.height - height) / 2 width: 2 height: parent.width / 3 - color: enabled ? "#353637" : "#bdbebf" + color: enabled ? Default.textColor : Default.textDisabledColor } } //! [up.indicator] @@ -123,14 +125,14 @@ T.SpinBox { height: parent.height implicitWidth: 40 implicitHeight: 40 - color: down.pressed ? "#d0d0d0" : "#e0e0e0" + color: down.pressed ? Default.buttonPressedColor : Default.buttonColor Rectangle { x: (parent.width - width) / 2 y: (parent.height - height) / 2 width: parent.width / 3 height: 2 - color: enabled ? "#353637" : "#bdbebf" + color: enabled ? Default.textColor : Default.textDisabledColor } } //! [down.indicator] @@ -139,7 +141,7 @@ T.SpinBox { background: Rectangle { opacity: control.enabled ? 1 : 0.3 implicitWidth: 140 - border.color: "#e0e0e0" + border.color: Default.buttonColor } //! [background] } diff --git a/src/imports/controls/SwipeDelegate.qml b/src/imports/controls/SwipeDelegate.qml index 6053aa94..729f623d 100644 --- a/src/imports/controls/SwipeDelegate.qml +++ b/src/imports/controls/SwipeDelegate.qml @@ -35,6 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Templates 2.1 as T T.SwipeDelegate { @@ -57,7 +59,7 @@ T.SwipeDelegate { text: control.text font: control.font - color: control.enabled ? "#26282a" : "#bdbebf" + color: control.enabled ? Default.textDarkColor : Default.textDisabledColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft @@ -75,7 +77,9 @@ T.SwipeDelegate { //! [background] background: Rectangle { - color: control.visualFocus ? (control.down ? "#cce0ff" : "#e5efff") : (control.down ? "#bdbebf" : "#ffffff") + color: control.visualFocus + ? (control.down ? Default.focusPressedColor : Default.delegateFocusColor) + : (control.down ? Default.delegatePressedColor : Default.backgroundColor) Behavior on x { enabled: !control.down diff --git a/src/imports/controls/Switch.qml b/src/imports/controls/Switch.qml index 124efda1..33304cdd 100644 --- a/src/imports/controls/Switch.qml +++ b/src/imports/controls/Switch.qml @@ -67,7 +67,7 @@ T.Switch { text: control.text font: control.font - color: control.enabled ? "#26282a" : "#bdbebf" + color: control.enabled ? Default.textDarkColor : Default.textDisabledColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft diff --git a/src/imports/controls/SwitchDelegate.qml b/src/imports/controls/SwitchDelegate.qml index 4bbc3403..decec965 100644 --- a/src/imports/controls/SwitchDelegate.qml +++ b/src/imports/controls/SwitchDelegate.qml @@ -67,7 +67,7 @@ T.SwitchDelegate { text: control.text font: control.font - color: control.enabled ? "#26282a" : "#bdbebf" + color: control.enabled ? Default.textDarkColor : Default.textDisabledColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft @@ -80,7 +80,7 @@ T.SwitchDelegate { implicitWidth: 100 implicitHeight: 40 visible: control.down || control.highlighted - color: control.down ? "#bdbebf" : "#eeeeee" + color: control.down ? Default.delegatePressedColor : Default.delegateColor } //! [background] } diff --git a/src/imports/controls/SwitchIndicator.qml b/src/imports/controls/SwitchIndicator.qml index f11f7147..e71b606f 100644 --- a/src/imports/controls/SwitchIndicator.qml +++ b/src/imports/controls/SwitchIndicator.qml @@ -35,6 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 Item { implicitWidth: 56 @@ -48,9 +50,9 @@ Item { height: 16 radius: 8 opacity: control.enabled ? 1 : 0.3 - color: control.checked ? (control.visualFocus ? "#0066ff" : "#353637") : "#e0e0e0" + color: control.checked ? (control.visualFocus ? Default.focusColor : Default.buttonCheckedColor) : Default.buttonColor border.width: control.visualFocus ? 2 : 0 - border.color: "#0066ff" + border.color: Default.focusColor } Rectangle { @@ -59,9 +61,13 @@ Item { width: 28 height: 28 radius: 16 - color: control.enabled ? (control.down ? (control.visualFocus ? "#cce0ff" : "#f6f6f6") : (control.visualFocus ? "#f0f6ff" : "#ffffff")) : "#fdfdfd" + color: control.enabled ? (control.down + ? (control.visualFocus ? Default.focusPressedColor : Default.indicatorPressedColor) + : (control.visualFocus ? Default.focusLightColor : Default.backgroundColor)) : Default.indicatorDisabledColor border.width: control.visualFocus ? 2 : 1 - border.color: control.enabled ? (control.visualFocus ? "#0066ff" : (control.down ? "#808080" : "#909090")) : "#d6d6d6" + border.color: control.enabled ? (control.visualFocus + ? Default.focusColor + : (control.down ? Default.indicatorFramePressedColor : Default.indicatorFrameColor)) : Default.indicatorFrameDisabledColor Behavior on x { enabled: !control.down diff --git a/src/imports/controls/TabButton.qml b/src/imports/controls/TabButton.qml index 77a4ca17..d7a5a7cd 100644 --- a/src/imports/controls/TabButton.qml +++ b/src/imports/controls/TabButton.qml @@ -35,6 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Templates 2.1 as T T.TabButton { @@ -54,7 +56,7 @@ T.TabButton { font: control.font elide: Text.ElideRight opacity: enabled ? 1 : 0.3 - color: !control.checked ? "#ffffff" : control.down ? "#26282a" : "#353637" + color: !control.checked ? Default.textLightColor : control.down ? Default.textDarkColor : Default.textColor horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } @@ -63,7 +65,9 @@ T.TabButton { //! [background] background: Rectangle { implicitHeight: 40 - color: control.down ? (control.checked ? "#e4e4e4" : "#585a5c") : (control.checked ? "transparent" : "#353637") + color: control.down + ? (control.checked ? Default.tabButtonCheckedPressedColor : Default.tabButtonPressedColor) + : (control.checked ? "transparent" : Default.tabButtonColor) } //! [background] } diff --git a/src/imports/controls/TextArea.qml b/src/imports/controls/TextArea.qml index 8fe34661..aaf69bb3 100644 --- a/src/imports/controls/TextArea.qml +++ b/src/imports/controls/TextArea.qml @@ -35,6 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Templates 2.1 as T T.TextArea { @@ -51,8 +53,8 @@ T.TextArea { leftPadding: padding + 4 opacity: enabled ? 1 : 0.2 - color: "#353637" - selectionColor: "#fddd5c" + color: Default.textColor + selectionColor: Default.textSelectionColor selectedTextColor: color Text { @@ -64,7 +66,7 @@ T.TextArea { text: control.placeholderText font: control.font - color: "#c2c2c2" + color: Default.textDisabledLightColor horizontalAlignment: control.horizontalAlignment verticalAlignment: control.verticalAlignment visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter) diff --git a/src/imports/controls/TextField.qml b/src/imports/controls/TextField.qml index 540a8da4..bb21ce84 100644 --- a/src/imports/controls/TextField.qml +++ b/src/imports/controls/TextField.qml @@ -35,6 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Templates 2.1 as T T.TextField { @@ -51,8 +53,8 @@ T.TextField { leftPadding: padding + 4 opacity: enabled ? 1 : 0.2 - color: "#353637" - selectionColor: "#fddd5c" + color: Default.textColor + selectionColor: Default.textSelectionColor selectedTextColor: color verticalAlignment: TextInput.AlignVCenter @@ -65,7 +67,7 @@ T.TextField { text: control.placeholderText font: control.font - color: "#bdbebf" + color: Default.textDisabledColor horizontalAlignment: control.horizontalAlignment verticalAlignment: control.verticalAlignment visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter) @@ -77,8 +79,8 @@ T.TextField { implicitWidth: 200 implicitHeight: 40 border.width: control.activeFocus ? 2 : 1 - color: control.enabled ? "#ffffff" : "#353637" - border.color: control.activeFocus ? "#0066ff" : (control.enabled ? "#bdbebf" : "transparent") + color: control.enabled ? Default.backgroundColor : Default.disabledDarkColor + border.color: control.activeFocus ? Default.focusColor : (control.enabled ? Default.disabledLightColor : "transparent") } //! [background] } diff --git a/src/imports/controls/ToolBar.qml b/src/imports/controls/ToolBar.qml index c0a2c467..70c61c78 100644 --- a/src/imports/controls/ToolBar.qml +++ b/src/imports/controls/ToolBar.qml @@ -35,6 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Templates 2.1 as T T.ToolBar { @@ -53,7 +55,7 @@ T.ToolBar { //! [background] background: Rectangle { implicitHeight: 40 - color: "#eeeeee" + color: Default.delegateColor } //! [background] } diff --git a/src/imports/controls/ToolButton.qml b/src/imports/controls/ToolButton.qml index 276e1f83..5d33e3e5 100644 --- a/src/imports/controls/ToolButton.qml +++ b/src/imports/controls/ToolButton.qml @@ -35,6 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Templates 2.1 as T T.ToolButton { @@ -52,7 +54,7 @@ T.ToolButton { contentItem: Text { text: control.text font: control.font - color: control.enabled ? (control.visualFocus ? "#0066ff" : "#26282a") : "#c2c2c2" + color: control.enabled ? (control.visualFocus ? Default.focusColor : Default.textDarkColor) : Default.textDisabledLightColor elide: Text.ElideRight horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter @@ -64,7 +66,7 @@ T.ToolButton { implicitWidth: 40 implicitHeight: 40 - color: Qt.darker("#33333333", control.enabled && (control.checked || control.highlighted) ? 1.5 : 1.0) + color: Qt.darker(Default.toolButtonColor, control.enabled && (control.checked || control.highlighted) ? 1.5 : 1.0) opacity: control.down ? 1.0 : control.enabled && (control.checked || control.highlighted) ? 0.5 : 0 visible: control.down || (control.enabled && (control.checked || control.highlighted)) } diff --git a/src/imports/controls/ToolSeparator.qml b/src/imports/controls/ToolSeparator.qml index 7e2192a2..894a5f97 100644 --- a/src/imports/controls/ToolSeparator.qml +++ b/src/imports/controls/ToolSeparator.qml @@ -35,6 +35,8 @@ ****************************************************************************/ import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Templates 2.1 as T T.ToolSeparator { @@ -51,7 +53,7 @@ T.ToolSeparator { contentItem: Rectangle { implicitWidth: vertical ? 1 : 30 implicitHeight: vertical ? 30 : 1 - color: "#ccc" + color: Default.separatorColor } //! [contentItem] } diff --git a/src/imports/controls/ToolTip.qml b/src/imports/controls/ToolTip.qml index ec729a12..304296dd 100644 --- a/src/imports/controls/ToolTip.qml +++ b/src/imports/controls/ToolTip.qml @@ -36,6 +36,7 @@ import QtQuick 2.6 import QtQuick.Controls 2.1 +import QtQuick.Controls.impl 2.1 import QtQuick.Templates 2.1 as T T.ToolTip { @@ -64,7 +65,7 @@ T.ToolTip { //! [background] background: Rectangle { - border.color: "#353637" + border.color: Default.frameDarkColor } //! [background] } diff --git a/src/imports/controls/Tumbler.qml b/src/imports/controls/Tumbler.qml index 371c705f..4c1e5ecd 100644 --- a/src/imports/controls/Tumbler.qml +++ b/src/imports/controls/Tumbler.qml @@ -47,7 +47,7 @@ T.Tumbler { delegate: Text { id: label text: modelData - color: control.visualFocus ? "#0066ff" : "#26282a" + color: control.visualFocus ? Default.focusColor : Default.textDarkColor font: control.font opacity: (1.0 - Math.abs(Tumbler.displacement) / (visibleItemCount / 2)) * (control.enabled ? 1 : 0.6) horizontalAlignment: Text.AlignHCenter diff --git a/src/imports/controls/controls.pri b/src/imports/controls/controls.pri index f84c59bc..499ec171 100644 --- a/src/imports/controls/controls.pri +++ b/src/imports/controls/controls.pri @@ -1,12 +1,14 @@ HEADERS += \ $$PWD/qquickbusyindicatorring_p.h \ $$PWD/qquickprogressstrip_p.h \ - $$PWD/qquickdialring_p.h + $$PWD/qquickdialring_p.h \ + $$PWD/qquickdefaultstyle_p.h SOURCES += \ $$PWD/qquickbusyindicatorring.cpp \ $$PWD/qquickprogressstrip.cpp \ - $$PWD/qquickdialring.cpp + $$PWD/qquickdialring.cpp \ + $$PWD/qquickdefaultstyle.cpp QML_CONTROLS = \ ApplicationWindow.qml \ diff --git a/src/imports/controls/qquickdefaultstyle.cpp b/src/imports/controls/qquickdefaultstyle.cpp new file mode 100644 index 00000000..7dfedfb7 --- /dev/null +++ b/src/imports/controls/qquickdefaultstyle.cpp @@ -0,0 +1,241 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qquickdefaultstyle_p.h" + +QT_BEGIN_NAMESPACE + +QQuickDefaultStyle::QQuickDefaultStyle(QObject *parent) : + QObject(parent) +{ +} + +QColor QQuickDefaultStyle::backgroundColor() const +{ + return QColor::fromRgba(0xFFFFFFFF); +} + +QColor QQuickDefaultStyle::overlayModalColor() const +{ + return QColor::fromRgba(0x7F28282A); +} + +QColor QQuickDefaultStyle::overlayDimColor() const +{ + return QColor::fromRgba(0x1F28282A); +} + +QColor QQuickDefaultStyle::textColor() const +{ + return QColor::fromRgba(0xFF353637); +} + +QColor QQuickDefaultStyle::textDarkColor() const +{ + return QColor::fromRgba(0xFF26282A); +} + +QColor QQuickDefaultStyle::textLightColor() const +{ + return QColor::fromRgba(0xFFFFFFFF); +} + +QColor QQuickDefaultStyle::textLinkColor() const +{ + return QColor::fromRgba(0xFF45A7D7); +} + +QColor QQuickDefaultStyle::textSelectionColor() const +{ + return QColor::fromRgba(0xFFFDDD5C); +} + +QColor QQuickDefaultStyle::textDisabledColor() const +{ + return QColor::fromRgba(0xFFBDBEBF); +} + +QColor QQuickDefaultStyle::textDisabledLightColor() const +{ + return QColor::fromRgba(0xFFC2C2C2); +} + +QColor QQuickDefaultStyle::focusColor() const +{ + return QColor::fromRgba(0xFF0066FF); +} + +QColor QQuickDefaultStyle::focusLightColor() const +{ + return QColor::fromRgba(0xFFF0F6FF); +} + +QColor QQuickDefaultStyle::focusPressedColor() const +{ + return QColor::fromRgba(0xFFCCE0FF); +} + +QColor QQuickDefaultStyle::buttonColor() const +{ + return QColor::fromRgba(0xFFE0E0E0); +} + +QColor QQuickDefaultStyle::buttonPressedColor() const +{ + return QColor::fromRgba(0xFFD0D0D0); +} + +QColor QQuickDefaultStyle::buttonCheckedColor() const +{ + return QColor::fromRgba(0xFF353637); +} + +QColor QQuickDefaultStyle::buttonCheckedPressedColor() const +{ + return QColor::fromRgba(0xFF585A5C); +} + +QColor QQuickDefaultStyle::buttonCheckedFocusColor() const +{ + return QColor::fromRgba(0xFF599BFF); +} + +QColor QQuickDefaultStyle::toolButtonColor() const +{ + return QColor::fromRgba(0x33333333); +} + +QColor QQuickDefaultStyle::tabButtonColor() const +{ + return QColor::fromRgba(0xFF353637); +} + +QColor QQuickDefaultStyle::tabButtonPressedColor() const +{ + return QColor::fromRgba(0xFF585A5C); +} + +QColor QQuickDefaultStyle::tabButtonCheckedPressedColor() const +{ + return QColor::fromRgba(0xFFE4E4E4); +} + +QColor QQuickDefaultStyle::delegateColor() const +{ + return QColor::fromRgba(0xFFEEEEEE); +} + +QColor QQuickDefaultStyle::delegatePressedColor() const +{ + return QColor::fromRgba(0xFFBDBEBF); +} + +QColor QQuickDefaultStyle::delegateFocusColor() const +{ + return QColor::fromRgba(0xFFE5EFFF); +} + +QColor QQuickDefaultStyle::indicatorPressedColor() const +{ + return QColor::fromRgba(0xFFF6F6F6); +} + +QColor QQuickDefaultStyle::indicatorDisabledColor() const +{ + return QColor::fromRgba(0xFFFDFDFD); +} + +QColor QQuickDefaultStyle::indicatorFrameColor() const +{ + return QColor::fromRgba(0xFF909090); +} + +QColor QQuickDefaultStyle::indicatorFramePressedColor() const +{ + return QColor::fromRgba(0xFF808080); +} + +QColor QQuickDefaultStyle::indicatorFrameDisabledColor() const +{ + return QColor::fromRgba(0xFFD6D6D6); +} + +QColor QQuickDefaultStyle::frameDarkColor() const +{ + return QColor::fromRgba(0xFF353637); +} + +QColor QQuickDefaultStyle::frameLightColor() const +{ + return QColor::fromRgba(0xFFBDBEBF); +} + +QColor QQuickDefaultStyle::scrollBarColor() const +{ + return QColor::fromRgba(0xFFBDBEBF); +} + +QColor QQuickDefaultStyle::scrollBarPressedColor() const +{ + return QColor::fromRgba(0xFF28282A); +} + +QColor QQuickDefaultStyle::progressBarColor() const +{ + return QColor::fromRgba(0xFFE4E4E4); +} + +QColor QQuickDefaultStyle::pageIndicatorColor() const +{ + return QColor::fromRgba(0xFF28282A); +} + +QColor QQuickDefaultStyle::separatorColor() const +{ + return QColor::fromRgba(0xFFCCCCCC); +} + +QColor QQuickDefaultStyle::disabledDarkColor() const +{ + return QColor::fromRgba(0xFF353637); +} + +QColor QQuickDefaultStyle::disabledLightColor() const +{ + return QColor::fromRgba(0xFFBDBEBF); +} + +QT_END_NAMESPACE diff --git a/src/imports/controls/qquickdefaultstyle_p.h b/src/imports/controls/qquickdefaultstyle_p.h new file mode 100644 index 00000000..854dc6c8 --- /dev/null +++ b/src/imports/controls/qquickdefaultstyle_p.h @@ -0,0 +1,145 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QQUICKDEFAULTSTYLE_P_H +#define QQUICKDEFAULTSTYLE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include + +QT_BEGIN_NAMESPACE + +class QQuickDefaultStyle : public QObject +{ + Q_OBJECT + Q_PROPERTY(QColor backgroundColor READ backgroundColor CONSTANT FINAL) + Q_PROPERTY(QColor overlayModalColor READ overlayModalColor CONSTANT FINAL) + Q_PROPERTY(QColor overlayDimColor READ overlayDimColor CONSTANT FINAL) + Q_PROPERTY(QColor textColor READ textColor CONSTANT FINAL) + Q_PROPERTY(QColor textDarkColor READ textDarkColor CONSTANT FINAL) + Q_PROPERTY(QColor textLightColor READ textLightColor CONSTANT FINAL) + Q_PROPERTY(QColor textLinkColor READ textLinkColor CONSTANT FINAL) + Q_PROPERTY(QColor textSelectionColor READ textSelectionColor CONSTANT FINAL) + Q_PROPERTY(QColor textDisabledColor READ textDisabledColor CONSTANT FINAL) + Q_PROPERTY(QColor textDisabledLightColor READ textDisabledLightColor CONSTANT FINAL) + Q_PROPERTY(QColor focusColor READ focusColor CONSTANT FINAL) + Q_PROPERTY(QColor focusLightColor READ focusLightColor CONSTANT FINAL) + Q_PROPERTY(QColor focusPressedColor READ focusPressedColor CONSTANT FINAL) + Q_PROPERTY(QColor buttonColor READ buttonColor CONSTANT FINAL) + Q_PROPERTY(QColor buttonPressedColor READ buttonPressedColor CONSTANT FINAL) + Q_PROPERTY(QColor buttonCheckedColor READ buttonCheckedColor CONSTANT FINAL) + Q_PROPERTY(QColor buttonCheckedPressedColor READ buttonCheckedPressedColor CONSTANT FINAL) + Q_PROPERTY(QColor buttonCheckedFocusColor READ buttonCheckedFocusColor CONSTANT FINAL) + Q_PROPERTY(QColor toolButtonColor READ toolButtonColor CONSTANT FINAL) + Q_PROPERTY(QColor tabButtonColor READ tabButtonColor CONSTANT FINAL) + Q_PROPERTY(QColor tabButtonPressedColor READ tabButtonPressedColor CONSTANT FINAL) + Q_PROPERTY(QColor tabButtonCheckedPressedColor READ tabButtonCheckedPressedColor CONSTANT FINAL) + Q_PROPERTY(QColor delegateColor READ delegateColor CONSTANT FINAL) + Q_PROPERTY(QColor delegatePressedColor READ delegatePressedColor CONSTANT FINAL) + Q_PROPERTY(QColor delegateFocusColor READ delegateFocusColor CONSTANT FINAL) + Q_PROPERTY(QColor indicatorPressedColor READ indicatorPressedColor CONSTANT FINAL) + Q_PROPERTY(QColor indicatorDisabledColor READ indicatorDisabledColor CONSTANT FINAL) + Q_PROPERTY(QColor indicatorFrameColor READ indicatorFrameColor CONSTANT FINAL) + Q_PROPERTY(QColor indicatorFramePressedColor READ indicatorFramePressedColor CONSTANT FINAL) + Q_PROPERTY(QColor indicatorFrameDisabledColor READ indicatorFrameDisabledColor CONSTANT FINAL) + Q_PROPERTY(QColor frameDarkColor READ frameDarkColor CONSTANT FINAL) + Q_PROPERTY(QColor frameLightColor READ frameLightColor CONSTANT FINAL) + Q_PROPERTY(QColor scrollBarColor READ scrollBarColor CONSTANT FINAL) + Q_PROPERTY(QColor scrollBarPressedColor READ scrollBarPressedColor CONSTANT FINAL) + Q_PROPERTY(QColor progressBarColor READ progressBarColor CONSTANT FINAL) + Q_PROPERTY(QColor pageIndicatorColor READ pageIndicatorColor CONSTANT FINAL) + Q_PROPERTY(QColor separatorColor READ separatorColor CONSTANT FINAL) + Q_PROPERTY(QColor disabledDarkColor READ disabledDarkColor CONSTANT FINAL) + Q_PROPERTY(QColor disabledLightColor READ disabledLightColor CONSTANT FINAL) + +public: + explicit QQuickDefaultStyle(QObject *parent = nullptr); + + QColor backgroundColor() const; + QColor overlayModalColor() const; + QColor overlayDimColor() const; + QColor textColor() const; + QColor textDarkColor() const; + QColor textLightColor() const; + QColor textLinkColor() const; + QColor textSelectionColor() const; + QColor textDisabledColor() const; + QColor textDisabledLightColor() const; + QColor focusColor() const; + QColor focusLightColor() const; + QColor focusPressedColor() const; + QColor buttonColor() const; + QColor buttonPressedColor() const; + QColor buttonCheckedColor() const; + QColor buttonCheckedPressedColor() const; + QColor buttonCheckedFocusColor() const; + QColor toolButtonColor() const; + QColor tabButtonColor() const; + QColor tabButtonPressedColor() const; + QColor tabButtonCheckedPressedColor() const; + QColor delegateColor() const; + QColor delegatePressedColor() const; + QColor delegateFocusColor() const; + QColor indicatorPressedColor() const; + QColor indicatorDisabledColor() const; + QColor indicatorFrameColor() const; + QColor indicatorFramePressedColor() const; + QColor indicatorFrameDisabledColor() const; + QColor frameDarkColor() const; + QColor frameLightColor() const; + QColor scrollBarColor() const; + QColor scrollBarPressedColor() const; + QColor progressBarColor() const; + QColor pageIndicatorColor() const; + QColor separatorColor() const; + QColor disabledDarkColor() const; + QColor disabledLightColor() const; +}; + +QT_END_NAMESPACE + +#endif // QQUICKDEFAULTSTYLE_P_H diff --git a/src/imports/controls/qtquickcontrols2plugin.cpp b/src/imports/controls/qtquickcontrols2plugin.cpp index f7ee00a6..b466d4d7 100644 --- a/src/imports/controls/qtquickcontrols2plugin.cpp +++ b/src/imports/controls/qtquickcontrols2plugin.cpp @@ -53,6 +53,7 @@ #include #include "qquickbusyindicatorring_p.h" +#include "qquickdefaultstyle_p.h" #include "qquickdialring_p.h" #include "qquickprogressstrip_p.h" @@ -148,6 +149,13 @@ void QtQuickControls2Plugin::registerTypes(const char *uri) qmlRegisterType(selector.select(QStringLiteral("ToolSeparator.qml")), uri, 2, 1, "ToolSeparator"); } +static QObject *styleSingleton(QQmlEngine *engine, QJSEngine *scriptEngine) +{ + Q_UNUSED(engine); + Q_UNUSED(scriptEngine); + return new QQuickDefaultStyle; +} + void QtQuickControls2Plugin::initializeEngine(QQmlEngine *engine, const char *uri) { Q_UNUSED(uri); @@ -161,6 +169,7 @@ void QtQuickControls2Plugin::initializeEngine(QQmlEngine *engine, const char *ur qmlRegisterType(import, 2, 0, "ProgressStripAnimator"); qmlRegisterType(import, 2, 0, "DialRing"); qmlRegisterType(import, 2, 1, "TumblerView"); + qmlRegisterSingletonType(import, 2, 1, "Default", styleSingleton); qmlRegisterType(typeUrl(QStringLiteral("CheckIndicator.qml")), import, 2, 0, "CheckIndicator"); qmlRegisterType(typeUrl(QStringLiteral("RadioIndicator.qml")), import, 2, 0, "RadioIndicator"); -- cgit v1.2.3