summaryrefslogtreecommitdiff
path: root/src/controls
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2014-06-25 10:27:39 +0200
committerJ-P Nurmi <jpnurmi@digia.com>2014-06-25 10:27:39 +0200
commit91caf7531476d16c1c7a6d22705cb36ac93c5ab7 (patch)
treee4f67bcd61c55ba2b8cb4a4d01b10f69837c74e8 /src/controls
parent1f0def9e8feca180680c1344cef6cf250b7630ba (diff)
parent6b876b21cd23f2af879543edf773dac41b4d0e97 (diff)
downloadqtquickcontrols-91caf7531476d16c1c7a6d22705cb36ac93c5ab7.tar.gz
Merge remote-tracking branch 'origin/5.3' into dev
Conflicts: .qmake.conf src/controls/Styles/Desktop/SpinBoxStyle.qml Change-Id: Ia501c1388a2af9f273ec2742abbfc766717ad9e6
Diffstat (limited to 'src/controls')
-rw-r--r--src/controls/ApplicationWindow.qml4
-rw-r--r--src/controls/ComboBox.qml21
-rw-r--r--src/controls/MenuBar.qml20
-rw-r--r--src/controls/Private/BasicButton.qml4
-rw-r--r--src/controls/Private/MenuContentItem.qml4
-rw-r--r--src/controls/Private/Style.qml6
-rw-r--r--src/controls/Private/SystemPaletteSingleton.qml63
-rw-r--r--src/controls/Private/private.pri3
-rw-r--r--src/controls/Private/qmldir1
-rw-r--r--src/controls/Private/qquickcontrolsettings.cpp2
-rw-r--r--src/controls/Slider.qml12
-rw-r--r--src/controls/Styles/Base/ButtonStyle.qml8
-rw-r--r--src/controls/Styles/Base/CalendarStyle.qml2
-rw-r--r--src/controls/Styles/Base/CheckBoxStyle.qml7
-rw-r--r--src/controls/Styles/Base/ComboBoxStyle.qml8
-rw-r--r--src/controls/Styles/Base/GroupBoxStyle.qml7
-rw-r--r--src/controls/Styles/Base/MenuBarStyle.qml4
-rw-r--r--src/controls/Styles/Base/ProgressBarStyle.qml5
-rw-r--r--src/controls/Styles/Base/RadioButtonStyle.qml7
-rw-r--r--src/controls/Styles/Base/ScrollViewStyle.qml5
-rw-r--r--src/controls/Styles/Base/SliderStyle.qml5
-rw-r--r--src/controls/Styles/Base/SpinBoxStyle.qml12
-rw-r--r--src/controls/Styles/Base/SwitchStyle.qml11
-rw-r--r--src/controls/Styles/Base/TabViewStyle.qml6
-rw-r--r--src/controls/Styles/Base/TableViewStyle.qml4
-rw-r--r--src/controls/Styles/Base/TextAreaStyle.qml8
-rw-r--r--src/controls/Styles/Base/TextFieldStyle.qml11
-rw-r--r--src/controls/Styles/Desktop/CheckBoxStyle.qml2
-rw-r--r--src/controls/Styles/Desktop/MenuStyle.qml2
-rw-r--r--src/controls/Styles/Desktop/RadioButtonStyle.qml2
-rw-r--r--src/controls/Styles/Desktop/SpinBoxStyle.qml13
-rw-r--r--src/controls/Styles/Desktop/TableViewStyle.qml6
-rw-r--r--src/controls/Styles/Desktop/TextAreaStyle.qml8
-rw-r--r--src/controls/Styles/Desktop/TextFieldStyle.qml13
-rw-r--r--src/controls/plugins.qmltypes2
35 files changed, 154 insertions, 144 deletions
diff --git a/src/controls/ApplicationWindow.qml b/src/controls/ApplicationWindow.qml
index f0a42e93..5ac73fbe 100644
--- a/src/controls/ApplicationWindow.qml
+++ b/src/controls/ApplicationWindow.qml
@@ -182,7 +182,7 @@ Window {
/*! \internal */
default property alias data: contentArea.data
- color: syspal.window
+ color: SystemPaletteSingleton.window(true)
flags: Qt.Window | Qt.WindowFullscreenButtonHint |
Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint |
@@ -190,8 +190,6 @@ Window {
// QTBUG-35049: Windows is removing features we didn't ask for, even though Qt::CustomizeWindowHint is not set
// Otherwise Qt.Window | Qt.WindowFullscreenButtonHint would be enough
- SystemPalette {id: syspal}
-
Item {
id: backgroundItem
anchors.fill: parent
diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml
index 7a101969..995cdcde 100644
--- a/src/controls/ComboBox.qml
+++ b/src/controls/ComboBox.qml
@@ -153,7 +153,7 @@ Control {
/*! \qmlproperty bool ComboBox::pressed
This property holds whether the button is being pressed. */
- readonly property bool pressed: mouseArea.pressed && mouseArea.containsMouse || popup.__popupVisible
+ readonly property bool pressed: mouseArea.effectivePressed || popup.__popupVisible
/*! \qmlproperty bool ComboBox::hovered
@@ -309,12 +309,23 @@ Control {
MouseArea {
id: mouseArea
+ property bool overridePressed: false
+ readonly property bool effectivePressed: (pressed || overridePressed) && containsMouse
anchors.fill: parent
hoverEnabled: true
onPressed: {
if (comboBox.activeFocusOnPress)
forceActiveFocus()
- popup.show()
+ if (!Settings.hasTouchScreen)
+ popup.show()
+ else
+ overridePressed = true
+ }
+ onCanceled: overridePressed = false
+ onClicked: {
+ if (Settings.hasTouchScreen)
+ popup.show()
+ overridePressed = false
}
onWheel: {
if (wheel.angleDelta.y > 0) {
@@ -361,9 +372,9 @@ Control {
font: __style && __style.editorFont !== undefined ? __style.editorFont : TextSingleton.font
renderType: __style ? __style.renderType : Text.NativeRendering
selectByMouse: true
- color: __style.__syspal.text
- selectionColor: __style.__syspal.highlight
- selectedTextColor: __style.__syspal.highlightedText
+ color: SystemPaletteSingleton.text(enabled)
+ selectionColor: SystemPaletteSingleton.highlight(enabled)
+ selectedTextColor: SystemPaletteSingleton.highlightedText(enabled)
onAccepted: {
var idx = input.find(editText, Qt.MatchFixedString)
if (idx > -1) {
diff --git a/src/controls/MenuBar.qml b/src/controls/MenuBar.qml
index 0fe56ef1..4d577930 100644
--- a/src/controls/MenuBar.qml
+++ b/src/controls/MenuBar.qml
@@ -174,8 +174,13 @@ MenuBarPrivate {
Keys.onLeftPressed: {
if (d.openedMenuIndex > 0) {
- d.preselectMenuItem = true
- d.openedMenuIndex--
+ var idx = d.openedMenuIndex - 1
+ while (idx >= 0 && !root.menus[idx].enabled)
+ idx--
+ if (idx >= 0) {
+ d.preselectMenuItem = true
+ d.openedMenuIndex = idx
+ }
} else {
event.accepted = false;
}
@@ -183,8 +188,13 @@ MenuBarPrivate {
Keys.onRightPressed: {
if (d.openedMenuIndex !== -1 && d.openedMenuIndex < root.menus.length - 1) {
- d.preselectMenuItem = true
- d.openedMenuIndex++
+ var idx = d.openedMenuIndex + 1
+ while (idx < root.menus.length && !root.menus[idx].enabled)
+ idx++
+ if (idx < root.menus.length) {
+ d.preselectMenuItem = true
+ d.openedMenuIndex = idx
+ }
} else {
event.accepted = false;
}
@@ -223,6 +233,8 @@ MenuBarPrivate {
Connections {
target: d
onOpenedMenuIndexChanged: {
+ if (!__menuItem.enabled)
+ return;
if (d.openedMenuIndex === index) {
if (__menuItem.__usingDefaultStyle)
__menuItem.style = d.style.menuStyle
diff --git a/src/controls/Private/BasicButton.qml b/src/controls/Private/BasicButton.qml
index 849315e9..f482ad72 100644
--- a/src/controls/Private/BasicButton.qml
+++ b/src/controls/Private/BasicButton.qml
@@ -126,8 +126,6 @@ Control {
property string iconName: action ? action.iconName : ""
/*! \internal */
- property color __textColor: syspal.text
- /*! \internal */
property string __position: "only"
/*! \internal */
readonly property bool __iconOverriden: button.action && (button.action.iconSource !== button.iconSource || button.action.iconName !== button.iconName)
@@ -218,8 +216,6 @@ Control {
/*! \internal */
property bool __effectivePressed: behavior.effectivePressed
- SystemPalette { id: syspal }
-
states: [
State {
name: "boundAction"
diff --git a/src/controls/Private/MenuContentItem.qml b/src/controls/Private/MenuContentItem.qml
index dbbf26a9..669cde2f 100644
--- a/src/controls/Private/MenuContentItem.qml
+++ b/src/controls/Private/MenuContentItem.qml
@@ -165,7 +165,7 @@ Loader {
itemsModel: __menu.items
minWidth: __menu.__minimumWidth
maxHeight: d.style ? d.style.__maxPopupHeight : 0
- onTriggered: d.triggerAndDismiss(item)
+ onTriggered: if (item.__menuItem.enabled) d.triggerAndDismiss(item)
}
Component {
@@ -199,6 +199,8 @@ Loader {
active: visible
function __showSubMenu(immediately) {
+ if (!__menuItem.enabled)
+ return;
if (immediately) {
if (__menu.__currentIndex === __menuItemIndex) {
if (__menuItem.__usingDefaultStyle)
diff --git a/src/controls/Private/Style.qml b/src/controls/Private/Style.qml
index e99db169..53497517 100644
--- a/src/controls/Private/Style.qml
+++ b/src/controls/Private/Style.qml
@@ -50,10 +50,4 @@ import QtQuick.Controls.Private 1.0
AbstractStyle {
/*! The control attached to this style */
readonly property Item control: __control
-
- /*! \internal */
- property var __syspal: SystemPalette {
- colorGroup: control.enabled ?
- SystemPalette.Active : SystemPalette.Disabled
- }
}
diff --git a/src/controls/Private/SystemPaletteSingleton.qml b/src/controls/Private/SystemPaletteSingleton.qml
new file mode 100644
index 00000000..9354af03
--- /dev/null
+++ b/src/controls/Private/SystemPaletteSingleton.qml
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 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 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+pragma Singleton
+import QtQuick 2.2
+
+QtObject {
+ property SystemPalette active: SystemPalette { colorGroup: SystemPalette.Active }
+ property SystemPalette disabled: SystemPalette { colorGroup: SystemPalette.Disabled }
+
+ function alternateBase(enabled) { return enabled ? active.alternateBase : disabled.alternateBase }
+ function base(enabled) { return enabled ? active.base : disabled.base }
+ function button(enabled) { return enabled ? active.button : disabled.button }
+ function buttonText(enabled) { return enabled ? active.buttonText : disabled.buttonText }
+ function dark(enabled) { return enabled ? active.dark : disabled.dark }
+ function highlight(enabled) { return enabled ? active.highlight : disabled.highlight }
+ function highlightedText(enabled) { return enabled ? active.highlightedText : disabled.highlightedText }
+ function light(enabled) { return enabled ? active.light : disabled.light }
+ function mid(enabled) { return enabled ? active.mid : disabled.mid }
+ function midlight(enabled) { return enabled ? active.midlight : disabled.midlight }
+ function shadow(enabled) { return enabled ? active.shadow : disabled.shadow }
+ function text(enabled) { return enabled ? active.text : disabled.text }
+ function window(enabled) { return enabled ? active.window : disabled.window }
+ function windowText(enabled) { return enabled ? active.windowText : disabled.windowText }
+}
diff --git a/src/controls/Private/private.pri b/src/controls/Private/private.pri
index f2da1ec9..e409ee4a 100644
--- a/src/controls/Private/private.pri
+++ b/src/controls/Private/private.pri
@@ -22,7 +22,7 @@ SOURCES += \
$$PWD/qquickabstractstyle.cpp
-!android: !ios: !blackberry: qtHaveModule(widgets) {
+!android:!ios:!blackberry:!qnx:!winrt:qtHaveModule(widgets) {
QT += widgets
HEADERS += $$PWD/qquickstyleitem_p.h
SOURCES += $$PWD/qquickstyleitem.cpp
@@ -46,6 +46,7 @@ PRIVATE_QML_FILES += \
$$PWD/StackView.js \
$$PWD/ScrollViewHelper.qml \
$$PWD/ScrollBar.qml \
+ $$PWD/SystemPaletteSingleton.qml \
$$PWD/TableViewSelection.qml \
$$PWD/TextHandle.qml \
$$PWD/TextSingleton.qml \
diff --git a/src/controls/Private/qmldir b/src/controls/Private/qmldir
index 589087bf..a40e2b4c 100644
--- a/src/controls/Private/qmldir
+++ b/src/controls/Private/qmldir
@@ -24,5 +24,6 @@ MenuContentScroller 1.0 MenuContentScroller.qml
ColumnMenuContent 1.0 ColumnMenuContent.qml
ContentItem 1.0 ContentItem.qml
HoverButton 1.0 HoverButton.qml
+singleton SystemPaletteSingleton 1.0 SystemPaletteSingleton.qml
singleton TextSingleton 1.0 TextSingleton.qml
TextHandle 1.0 TextHandle.qml
diff --git a/src/controls/Private/qquickcontrolsettings.cpp b/src/controls/Private/qquickcontrolsettings.cpp
index e1d0cabb..b7ebc213 100644
--- a/src/controls/Private/qquickcontrolsettings.cpp
+++ b/src/controls/Private/qquickcontrolsettings.cpp
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
static QString defaultStyleName()
{
//Only enable QStyle support when we are using QApplication
-#if !defined(Q_OS_IOS) && !defined(Q_OS_ANDROID) && !defined (Q_OS_BLACKBERRY)
+#if !defined(Q_OS_IOS) && !defined(Q_OS_ANDROID) && !defined(Q_OS_BLACKBERRY) && !defined(Q_OS_QNX) && !defined(Q_OS_WINRT)
if (QCoreApplication::instance()->inherits("QApplication"))
return QLatin1String("Desktop");
#endif
diff --git a/src/controls/Slider.qml b/src/controls/Slider.qml
index 2838ed7e..af5b89cd 100644
--- a/src/controls/Slider.qml
+++ b/src/controls/Slider.qml
@@ -237,18 +237,22 @@ Control {
onMouseXChanged: {
if (pressed && __horizontal) {
var pos = clamp (mouse.x + clickOffset - fakeHandle.width/2)
- fakeHandle.x = pos
- if (Math.abs(mouse.x - pressX) >= Settings.dragThreshold)
+ var overThreshold = Math.abs(mouse.x - pressX) >= Settings.dragThreshold
+ if (overThreshold)
preventStealing = true
+ if (overThreshold || !Settings.hasTouchScreen)
+ fakeHandle.x = pos
}
}
onMouseYChanged: {
if (pressed && !__horizontal) {
var pos = clamp (mouse.y + clickOffset- fakeHandle.height/2)
- fakeHandle.y = pos
- if (Math.abs(mouse.y - pressY) >= Settings.dragThreshold)
+ var overThreshold = Math.abs(mouse.y - pressY) >= Settings.dragThreshold
+ if (overThreshold)
preventStealing = true
+ if (overThreshold || !Settings.hasTouchScreen)
+ fakeHandle.y = pos
}
}
diff --git a/src/controls/Styles/Base/ButtonStyle.qml b/src/controls/Styles/Base/ButtonStyle.qml
index d0299a55..566f93e5 100644
--- a/src/controls/Styles/Base/ButtonStyle.qml
+++ b/src/controls/Styles/Base/ButtonStyle.qml
@@ -79,12 +79,6 @@ Style {
/*! The \l {QtQuick.Controls::}{Button} attached to this style. */
readonly property Button control: __control
- /*! \internal */
- property var __syspal: SystemPalette {
- colorGroup: control.enabled ?
- SystemPalette.Active : SystemPalette.Disabled
- }
-
/*! The padding between the background and the label components. */
padding {
top: 4
@@ -150,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 b5485d82..26ca2048 100644
--- a/src/controls/Styles/Base/CalendarStyle.qml
+++ b/src/controls/Styles/Base/CalendarStyle.qml
@@ -272,7 +272,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 2dcaa9e9..c8592b76 100644
--- a/src/controls/Styles/Base/CheckBoxStyle.qml
+++ b/src/controls/Styles/Base/CheckBoxStyle.qml
@@ -78,11 +78,6 @@ Style {
/*! The \l CheckBox attached to this style. */
readonly property CheckBox control: __control
- /*! \internal */
- property var __syspal: SystemPalette {
- colorGroup: control.enabled ?
- SystemPalette.Active : SystemPalette.Disabled
- }
/*! This defines the text label. */
property Component label: Item {
@@ -105,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 eed7e7f4..de78dc02 100644
--- a/src/controls/Styles/Base/ComboBoxStyle.qml
+++ b/src/controls/Styles/Base/ComboBoxStyle.qml
@@ -69,11 +69,7 @@ Style {
\sa Text::renderType
*/
property int renderType: Text.NativeRendering
- /*! \internal */
- property var __syspal: SystemPalette {
- colorGroup: control.enabled ?
- SystemPalette.Active : SystemPalette.Disabled
- }
+
/*! The \l ComboBox attached to this style. */
readonly property ComboBox control: __control
@@ -172,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 af8d41b6..545ca07b 100644
--- a/src/controls/Styles/Base/GroupBoxStyle.qml
+++ b/src/controls/Styles/Base/GroupBoxStyle.qml
@@ -50,11 +50,6 @@ import QtQuick.Controls.Private 1.0
*/
Style {
- /*! \internal */
- property var __syspal: SystemPalette {
- colorGroup: control.enabled ?
- SystemPalette.Active : SystemPalette.Disabled
- }
/*! The \l GroupBox attached to this style. */
readonly property GroupBox control: __control
@@ -67,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 8ab758f5..cff2b095 100644
--- a/src/controls/Styles/Base/MenuBarStyle.qml
+++ b/src/controls/Styles/Base/MenuBarStyle.qml
@@ -100,14 +100,12 @@ Style {
implicitHeight: text.height + 4
color: styleData.open ? "#49d" : "transparent"
- SystemPalette { id: syspal }
-
Text {
id: text
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/ProgressBarStyle.qml b/src/controls/Styles/Base/ProgressBarStyle.qml
index 0a98beef..ec379884 100644
--- a/src/controls/Styles/Base/ProgressBarStyle.qml
+++ b/src/controls/Styles/Base/ProgressBarStyle.qml
@@ -111,11 +111,6 @@ import QtQuick.Controls.Private 1.0
Style {
id: progressBarStyle
- /*! \internal */
- property var __syspal: SystemPalette {
- colorGroup: control.enabled ?
- SystemPalette.Active : SystemPalette.Disabled
- }
/*! The \l ProgressBar attached to this style. */
readonly property ProgressBar control: __control
diff --git a/src/controls/Styles/Base/RadioButtonStyle.qml b/src/controls/Styles/Base/RadioButtonStyle.qml
index 0f242eb0..86b7c816 100644
--- a/src/controls/Styles/Base/RadioButtonStyle.qml
+++ b/src/controls/Styles/Base/RadioButtonStyle.qml
@@ -75,11 +75,6 @@ import QtQuick.Controls.Private 1.0
Style {
id: radiobuttonStyle
- /*! \internal */
- property var __syspal: SystemPalette {
- colorGroup: control.enabled ?
- SystemPalette.Active : SystemPalette.Disabled
- }
/*! The \l RadioButton attached to this style. */
readonly property RadioButton control: __control
@@ -104,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/ScrollViewStyle.qml b/src/controls/Styles/Base/ScrollViewStyle.qml
index a962d807..20fc5a19 100644
--- a/src/controls/Styles/Base/ScrollViewStyle.qml
+++ b/src/controls/Styles/Base/ScrollViewStyle.qml
@@ -51,11 +51,6 @@ import QtQuick.Controls.Private 1.0
Style {
id: root
- /*! \internal */
- property var __syspal: SystemPalette {
- colorGroup: control.enabled ?
- SystemPalette.Active : SystemPalette.Disabled
- }
/*! The \l ScrollView attached to this style. */
readonly property ScrollView control: __control
diff --git a/src/controls/Styles/Base/SliderStyle.qml b/src/controls/Styles/Base/SliderStyle.qml
index d5109089..1e2750fb 100644
--- a/src/controls/Styles/Base/SliderStyle.qml
+++ b/src/controls/Styles/Base/SliderStyle.qml
@@ -82,11 +82,6 @@ import QtQuick.Controls.Private 1.0
Style {
id: styleitem
- /*! \internal */
- property var __syspal: SystemPalette {
- colorGroup: control.enabled ?
- SystemPalette.Active : SystemPalette.Disabled
- }
/*! The \l Slider attached to this style. */
readonly property Slider control: __control
diff --git a/src/controls/Styles/Base/SpinBoxStyle.qml b/src/controls/Styles/Base/SpinBoxStyle.qml
index 57b26ec4..6c76386f 100644
--- a/src/controls/Styles/Base/SpinBoxStyle.qml
+++ b/src/controls/Styles/Base/SpinBoxStyle.qml
@@ -69,12 +69,6 @@ Style {
/*! The \l SpinBox attached to this style. */
readonly property SpinBox control: __control
- /*! \internal */
- property var __syspal: SystemPalette {
- colorGroup: control.enabled ?
- SystemPalette.Active : SystemPalette.Disabled
- }
-
/*! The content margins of the text field. */
padding { top: 1 ; left: Math.round(styleData.contentHeight/2) ; right: Math.max(22, Math.round(styleData.contentHeight)) ; bottom: 0 }
/*! \qmlproperty enumeration horizontalAlignment
@@ -93,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 f13787ad..44c6ca72 100644
--- a/src/controls/Styles/Base/TabViewStyle.qml
+++ b/src/controls/Styles/Base/TabViewStyle.qml
@@ -169,11 +169,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 4ffefe63..301ac165 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 dc25033a..f33d4876 100644
--- a/src/controls/Styles/Base/TextFieldStyle.qml
+++ b/src/controls/Styles/Base/TextFieldStyle.qml
@@ -68,11 +68,6 @@ import QtQuick.Controls.Private 1.0
Style {
id: style
- /*! \internal */
- property var __syspal: SystemPalette {
- colorGroup: control.enabled ?
- SystemPalette.Active : SystemPalette.Disabled
- }
/*! The \l TextField attached to this style. */
readonly property TextField control: __control
@@ -83,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
diff --git a/src/controls/Styles/Desktop/CheckBoxStyle.qml b/src/controls/Styles/Desktop/CheckBoxStyle.qml
index 7a4c4639..4fb7d47a 100644
--- a/src/controls/Styles/Desktop/CheckBoxStyle.qml
+++ b/src/controls/Styles/Desktop/CheckBoxStyle.qml
@@ -74,7 +74,7 @@ Style {
renderType: Text.NativeRendering
elide: Text.ElideRight
enabled: control.enabled
- color: __syspal.windowText
+ color: SystemPaletteSingleton.windowText(control.enabled)
StyleItem {
elementType: "focusrect"
anchors.margins: -1
diff --git a/src/controls/Styles/Desktop/MenuStyle.qml b/src/controls/Styles/Desktop/MenuStyle.qml
index 4a0d5894..ecd898cf 100644
--- a/src/controls/Styles/Desktop/MenuStyle.qml
+++ b/src/controls/Styles/Desktop/MenuStyle.qml
@@ -61,7 +61,7 @@ Style {
fill: parent
margins: pixelMetric("menupanelwidth")
}
- color: __syspal.window
+ color: SystemPaletteSingleton.window(control.enabled)
}
Accessible.role: Accessible.PopupMenu
diff --git a/src/controls/Styles/Desktop/RadioButtonStyle.qml b/src/controls/Styles/Desktop/RadioButtonStyle.qml
index 2babc77c..a1809ad2 100644
--- a/src/controls/Styles/Desktop/RadioButtonStyle.qml
+++ b/src/controls/Styles/Desktop/RadioButtonStyle.qml
@@ -77,7 +77,7 @@ Style {
renderType: Text.NativeRendering
elide: Text.ElideRight
enabled: control.enabled
- color: __syspal.windowText
+ color: SystemPaletteSingleton.windowText(control.enabled)
StyleItem {
elementType: "focusrect"
anchors.margins: -1
diff --git a/src/controls/Styles/Desktop/SpinBoxStyle.qml b/src/controls/Styles/Desktop/SpinBoxStyle.qml
index da3beeff..d7d32916 100644
--- a/src/controls/Styles/Desktop/SpinBoxStyle.qml
+++ b/src/controls/Styles/Desktop/SpinBoxStyle.qml
@@ -44,11 +44,6 @@ import QtQuick.Controls.Private 1.0
Style {
readonly property SpinBox control: __control
- property var __syspal: SystemPalette {
- colorGroup: control.enabled ?
- SystemPalette.Active : SystemPalette.Disabled
- }
-
padding {
top: control.__panel ? control.__panel.topPadding + (styleitem.style === "mac" ? 2 : 0) : 0
left: control.__panel ? control.__panel.leftPadding : 0
@@ -70,10 +65,10 @@ Style {
property alias font: styleitem.font
- property color foregroundColor: __syspal.text
- property color backgroundColor: __syspal.base
- property color selectionColor: __syspal.highlight
- property color selectedTextColor: __syspal.highlightedText
+ property color foregroundColor: SystemPaletteSingleton.text(control.enabled)
+ property color backgroundColor: SystemPaletteSingleton.base(control.enabled)
+ property color selectionColor: SystemPaletteSingleton.highlight(control.enabled)
+ property color selectedTextColor: SystemPaletteSingleton.highlightedText(control.enabled)
property int topPadding: edit.anchors.topMargin
property int leftPadding: 3 + edit.anchors.leftMargin
diff --git a/src/controls/Styles/Desktop/TableViewStyle.qml b/src/controls/Styles/Desktop/TableViewStyle.qml
index 5ad1f394..605c62d6 100644
--- a/src/controls/Styles/Desktop/TableViewStyle.qml
+++ b/src/controls/Styles/Desktop/TableViewStyle.qml
@@ -45,14 +45,10 @@ import "."
ScrollViewStyle {
id: root
- property var __syspal: SystemPalette {
- colorGroup: control.enabled ?
- SystemPalette.Active : SystemPalette.Disabled
- }
readonly property TableView control: __control
property bool activateItemOnSingleClick: __styleitem.styleHint("activateItemOnSingleClick")
property color textColor: __styleitem.textColor
- property color backgroundColor: __syspal.base
+ property color backgroundColor: SystemPaletteSingleton.base(control.enabled)
property color highlightedTextColor: __styleitem.highlightedTextColor
property StyleItem __styleitem: StyleItem{
diff --git a/src/controls/Styles/Desktop/TextAreaStyle.qml b/src/controls/Styles/Desktop/TextAreaStyle.qml
index 46750c1a..9a177303 100644
--- a/src/controls/Styles/Desktop/TextAreaStyle.qml
+++ b/src/controls/Styles/Desktop/TextAreaStyle.qml
@@ -43,10 +43,10 @@ import QtQuick.Controls.Private 1.0
ScrollViewStyle {
property font font: __styleitem.font
- property color textColor: __syspal.text
- property color selectionColor: __syspal.highlight
- property color selectedTextColor: __syspal.highlightedText
- property color backgroundColor: control.backgroundVisible ? __syspal.base : "transparent"
+ property color textColor: SystemPaletteSingleton.text(control.enabled)
+ property color selectionColor: SystemPaletteSingleton.highlight(control.enabled)
+ property color selectedTextColor: SystemPaletteSingleton.highlightedText(control.enabled)
+ property color backgroundColor: control.backgroundVisible ? SystemPaletteSingleton.base(control.enabled) : "transparent"
property StyleItem __styleitem: StyleItem{
elementType: "edit"
diff --git a/src/controls/Styles/Desktop/TextFieldStyle.qml b/src/controls/Styles/Desktop/TextFieldStyle.qml
index c7e85ff4..585df03d 100644
--- a/src/controls/Styles/Desktop/TextFieldStyle.qml
+++ b/src/controls/Styles/Desktop/TextFieldStyle.qml
@@ -54,17 +54,10 @@ Style {
hover: hovered
hints: control.styleHints
- SystemPalette {
- id: syspal
- colorGroup: control.enabled ?
- SystemPalette.Active :
- SystemPalette.Disabled
- }
-
- property color textColor: syspal.text
+ property color textColor: SystemPaletteSingleton.text(control.enabled)
property color placeholderTextColor: "darkGray"
- property color selectionColor: syspal.highlight
- property color selectedTextColor: syspal.highlightedText
+ property color selectionColor: SystemPaletteSingleton.highlight(control.enabled)
+ property color selectedTextColor: SystemPaletteSingleton.highlightedText(control.enabled)
property bool rounded: !!hints["rounded"]
diff --git a/src/controls/plugins.qmltypes b/src/controls/plugins.qmltypes
index a9d6e527..d1a56b89 100644
--- a/src/controls/plugins.qmltypes
+++ b/src/controls/plugins.qmltypes
@@ -1201,7 +1201,6 @@ Module {
Property { name: "tooltip"; type: "string" }
Property { name: "iconSource"; type: "QUrl" }
Property { name: "iconName"; type: "string" }
- Property { name: "__textColor"; type: "QColor" }
Property { name: "__position"; type: "string" }
Property { name: "__iconOverriden"; type: "bool"; isReadonly: true }
Property { name: "__action"; type: "QQuickAction"; isPointer: true }
@@ -2182,7 +2181,6 @@ Module {
Property { name: "tooltip"; type: "string" }
Property { name: "iconSource"; type: "QUrl" }
Property { name: "iconName"; type: "string" }
- Property { name: "__textColor"; type: "QColor" }
Property { name: "__position"; type: "string" }
Property { name: "__iconOverriden"; type: "bool"; isReadonly: true }
Property { name: "__action"; type: "QQuickAction"; isPointer: true }