diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2014-06-18 21:28:33 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@digia.com> | 2014-06-23 09:14:24 +0200 |
commit | 266fab2a8920dc79e52555b81cf1708233c1b60f (patch) | |
tree | 4829c6903c95f7582abdfbb1265cf50c98381e35 /src/controls/Styles/Base | |
parent | 9578edd239f4f1e33d2bf5c044b1bf80ab2c595d (diff) | |
download | qtquickcontrols-266fab2a8920dc79e52555b81cf1708233c1b60f.tar.gz |
Singleton SystemPalette
Each SystemPalette instance installs an event filter on the
application object. Avoid this by sharing a single SystemPalette
instance.
Change-Id: Ica9f8979b33e511c1238add3d689f380d0daa93c
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
Diffstat (limited to 'src/controls/Styles/Base')
-rw-r--r-- | src/controls/Styles/Base/ButtonStyle.qml | 2 | ||||
-rw-r--r-- | src/controls/Styles/Base/CalendarStyle.qml | 2 | ||||
-rw-r--r-- | src/controls/Styles/Base/CheckBoxStyle.qml | 2 | ||||
-rw-r--r-- | src/controls/Styles/Base/ComboBoxStyle.qml | 2 | ||||
-rw-r--r-- | src/controls/Styles/Base/GroupBoxStyle.qml | 2 | ||||
-rw-r--r-- | src/controls/Styles/Base/MenuBarStyle.qml | 2 | ||||
-rw-r--r-- | src/controls/Styles/Base/RadioButtonStyle.qml | 2 | ||||
-rw-r--r-- | src/controls/Styles/Base/SpinBoxStyle.qml | 6 | ||||
-rw-r--r-- | src/controls/Styles/Base/SwitchStyle.qml | 11 | ||||
-rw-r--r-- | src/controls/Styles/Base/TabViewStyle.qml | 6 | ||||
-rw-r--r-- | src/controls/Styles/Base/TableViewStyle.qml | 4 | ||||
-rw-r--r-- | src/controls/Styles/Base/TextAreaStyle.qml | 8 | ||||
-rw-r--r-- | src/controls/Styles/Base/TextFieldStyle.qml | 6 |
13 files changed, 27 insertions, 28 deletions
diff --git a/src/controls/Styles/Base/ButtonStyle.qml b/src/controls/Styles/Base/ButtonStyle.qml index 98336964..566f93e5 100644 --- a/src/controls/Styles/Base/ButtonStyle.qml +++ b/src/controls/Styles/Base/ButtonStyle.qml @@ -144,7 +144,7 @@ Style { renderType: Text.NativeRendering anchors.verticalCenter: parent.verticalCenter text: control.text - color: __syspal.buttonText + color: SystemPaletteSingleton.buttonText(control.enabled) } } } diff --git a/src/controls/Styles/Base/CalendarStyle.qml b/src/controls/Styles/Base/CalendarStyle.qml index db007812..56978ded 100644 --- a/src/controls/Styles/Base/CalendarStyle.qml +++ b/src/controls/Styles/Base/CalendarStyle.qml @@ -266,7 +266,7 @@ Style { readonly property bool addExtraMargin: control.frameVisible && styleData.selected readonly property color sameMonthDateTextColor: "#444" - readonly property color selectedDateColor: Qt.platform.os === "osx" ? "#3778d0" : __syspal.highlight + readonly property color selectedDateColor: Qt.platform.os === "osx" ? "#3778d0" : SystemPaletteSingleton.highlight(control.enabled) readonly property color selectedDateTextColor: "white" readonly property color differentMonthDateTextColor: "#bbb" readonly property color invalidDateColor: "#dddddd" diff --git a/src/controls/Styles/Base/CheckBoxStyle.qml b/src/controls/Styles/Base/CheckBoxStyle.qml index 36eeb78f..c8592b76 100644 --- a/src/controls/Styles/Base/CheckBoxStyle.qml +++ b/src/controls/Styles/Base/CheckBoxStyle.qml @@ -100,7 +100,7 @@ Style { id: text text: control.text anchors.centerIn: parent - color: __syspal.text + color: SystemPaletteSingleton.text(control.enabled) renderType: Text.NativeRendering } } diff --git a/src/controls/Styles/Base/ComboBoxStyle.qml b/src/controls/Styles/Base/ComboBoxStyle.qml index 6bf8a391..de78dc02 100644 --- a/src/controls/Styles/Base/ComboBoxStyle.qml +++ b/src/controls/Styles/Base/ComboBoxStyle.qml @@ -168,7 +168,7 @@ Style { anchors.verticalCenter: parent.verticalCenter text: control.currentText renderType: cbStyle.renderType - color: __syspal.text + color: SystemPaletteSingleton.text(control.enabled) elide: Text.ElideRight } } diff --git a/src/controls/Styles/Base/GroupBoxStyle.qml b/src/controls/Styles/Base/GroupBoxStyle.qml index e001fb26..545ca07b 100644 --- a/src/controls/Styles/Base/GroupBoxStyle.qml +++ b/src/controls/Styles/Base/GroupBoxStyle.qml @@ -62,7 +62,7 @@ Style { } /*! The title text color. */ - property color textColor: __syspal.text + property color textColor: SystemPaletteSingleton.text(control.enabled) /*! The check box. */ property Component checkbox: Item { diff --git a/src/controls/Styles/Base/MenuBarStyle.qml b/src/controls/Styles/Base/MenuBarStyle.qml index 5c566b3a..cff2b095 100644 --- a/src/controls/Styles/Base/MenuBarStyle.qml +++ b/src/controls/Styles/Base/MenuBarStyle.qml @@ -105,7 +105,7 @@ Style { text: formatMnemonic(styleData.text, styleData.underlineMnemonic) anchors.centerIn: parent renderType: Text.NativeRendering - color: styleData.open ? "white" : __syspal.windowText + color: styleData.open ? "white" : SystemPaletteSingleton.windowText(control.enabled) } } diff --git a/src/controls/Styles/Base/RadioButtonStyle.qml b/src/controls/Styles/Base/RadioButtonStyle.qml index bedd3dca..86b7c816 100644 --- a/src/controls/Styles/Base/RadioButtonStyle.qml +++ b/src/controls/Styles/Base/RadioButtonStyle.qml @@ -99,7 +99,7 @@ Style { id: text text: control.text anchors.centerIn: parent - color: __syspal.text + color: SystemPaletteSingleton.text(control.enabled) renderType: Text.NativeRendering } } diff --git a/src/controls/Styles/Base/SpinBoxStyle.qml b/src/controls/Styles/Base/SpinBoxStyle.qml index c9df4471..ffd30a58 100644 --- a/src/controls/Styles/Base/SpinBoxStyle.qml +++ b/src/controls/Styles/Base/SpinBoxStyle.qml @@ -87,13 +87,13 @@ Style { property int horizontalAlignment: Qt.AlignRight /*! The text color. */ - property color textColor: __syspal.text + property color textColor: SystemPaletteSingleton.text(control.enabled) /*! The text highlight color, used behind selections. */ - property color selectionColor: __syspal.highlight + property color selectionColor: SystemPaletteSingleton.highlight(control.enabled) /*! The highlighted text color, used in selections. */ - property color selectedTextColor: __syspal.highlightedText + property color selectedTextColor: SystemPaletteSingleton.highlightedText(control.enabled) /*! \qmlproperty enumeration renderType diff --git a/src/controls/Styles/Base/SwitchStyle.qml b/src/controls/Styles/Base/SwitchStyle.qml index 01779582..d5c5cf07 100644 --- a/src/controls/Styles/Base/SwitchStyle.qml +++ b/src/controls/Styles/Base/SwitchStyle.qml @@ -80,8 +80,10 @@ Style { implicitWidth: Math.round((parent.parent.width - padding.left - padding.right)/2) implicitHeight: control.height - padding.top - padding.bottom - border.color: control.activeFocus ? Qt.darker(__syspal.highlight, 2) : Qt.darker(__syspal.button, 2) - property color bg: control.activeFocus ? Qt.darker(__syspal.highlight, 1.2) : __syspal.button + border.color: control.activeFocus ? Qt.darker(highlight, 2) : Qt.darker(button, 2) + property color bg: control.activeFocus ? Qt.darker(highlight, 1.2) : button + property color highlight: SystemPaletteSingleton.highlight(control.enabled) + property color button: SystemPaletteSingleton.button(control.enabled) gradient: Gradient { GradientStop {color: Qt.lighter(bg, 1.4) ; position: 0} GradientStop {color: bg ; position: 1} @@ -92,8 +94,9 @@ Style { /*! This property holds the background groove of the switch. */ property Component groove: Rectangle { - property color shadow: control.checked ? Qt.darker(__syspal.highlight, 1.2): "#999" - property color bg: control.checked ? __syspal.highlight:"#bbb" + property color shadow: control.checked ? Qt.darker(highlight, 1.2): "#999" + property color bg: control.checked ? highlight:"#bbb" + property color highlight: SystemPaletteSingleton.highlight(control.enabled) implicitWidth: Math.round(implicitHeight * 3) implicitHeight: Math.max(16, Math.round(TextSingleton.implicitHeight)) diff --git a/src/controls/Styles/Base/TabViewStyle.qml b/src/controls/Styles/Base/TabViewStyle.qml index 42fabfe4..ad1d3856 100644 --- a/src/controls/Styles/Base/TabViewStyle.qml +++ b/src/controls/Styles/Base/TabViewStyle.qml @@ -168,11 +168,7 @@ Style { elide: Text.ElideMiddle renderType: Text.NativeRendering scale: control.tabPosition === Qt.TopEdge ? 1 : -1 - property var __syspal: SystemPalette { - colorGroup: styleData.enabled ? - SystemPalette.Active : SystemPalette.Disabled - } - color: __syspal.text + color: SystemPaletteSingleton.text(styleData.enabled) Rectangle { anchors.centerIn: parent width: textitem.paintedWidth + 6 diff --git a/src/controls/Styles/Base/TableViewStyle.qml b/src/controls/Styles/Base/TableViewStyle.qml index 5dca6631..b59a38ca 100644 --- a/src/controls/Styles/Base/TableViewStyle.qml +++ b/src/controls/Styles/Base/TableViewStyle.qml @@ -58,10 +58,10 @@ ScrollViewStyle { readonly property TableView control: __control /*! The text color. */ - property color textColor: __syspal.text + property color textColor: SystemPaletteSingleton.text(control.enabled) /*! The background color. */ - property color backgroundColor: control.backgroundVisible ? __syspal.base : "transparent" + property color backgroundColor: control.backgroundVisible ? SystemPaletteSingleton.base(control.enabled) : "transparent" /*! The alternate background color. */ property color alternateBackgroundColor: "#f5f5f5" diff --git a/src/controls/Styles/Base/TextAreaStyle.qml b/src/controls/Styles/Base/TextAreaStyle.qml index 7ad5686f..774f5cc6 100644 --- a/src/controls/Styles/Base/TextAreaStyle.qml +++ b/src/controls/Styles/Base/TextAreaStyle.qml @@ -71,16 +71,16 @@ ScrollViewStyle { property font font /*! The text color. */ - property color textColor: __syspal.text + property color textColor: SystemPaletteSingleton.text(control.enabled) /*! The text highlight color, used behind selections. */ - property color selectionColor: __syspal.highlight + property color selectionColor: SystemPaletteSingleton.highlight(control.enabled) /*! The highlighted text color, used in selections. */ - property color selectedTextColor: __syspal.highlightedText + property color selectedTextColor: SystemPaletteSingleton.highlightedText(control.enabled) /*! The background color. */ - property color backgroundColor: control.backgroundVisible ? __syspal.base : "transparent" + property color backgroundColor: control.backgroundVisible ? SystemPaletteSingleton.base(control.enabled) : "transparent" /*! \qmlproperty enumeration renderType diff --git a/src/controls/Styles/Base/TextFieldStyle.qml b/src/controls/Styles/Base/TextFieldStyle.qml index a0bed38d..4fe0d0a9 100644 --- a/src/controls/Styles/Base/TextFieldStyle.qml +++ b/src/controls/Styles/Base/TextFieldStyle.qml @@ -78,13 +78,13 @@ Style { property font font /*! The text color. */ - property color textColor: __syspal.text + property color textColor: SystemPaletteSingleton.text(control.enabled) /*! The text highlight color, used behind selections. */ - property color selectionColor: __syspal.highlight + property color selectionColor: SystemPaletteSingleton.highlight(control.enabled) /*! The highlighted text color, used in selections. */ - property color selectedTextColor: __syspal.highlightedText + property color selectedTextColor: SystemPaletteSingleton.highlightedText(control.enabled) /*! \qmlproperty enumeration renderType |