aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/material
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-03-18 11:54:17 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-03-18 11:54:18 +0100
commit6600826ce190e095e457b6394bb595fa9027302b (patch)
treea1612ea3e23ca8a7eab83b1840de85d961110352 /src/imports/controls/material
parent7da5842647f75fd990f69f400f75d9b090e39306 (diff)
parent9bfe2ad59977e6bcde18e03d7cb32ac701d6e883 (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Diffstat (limited to 'src/imports/controls/material')
-rw-r--r--src/imports/controls/material/RangeSlider.qml19
-rw-r--r--src/imports/controls/material/Slider.qml13
-rw-r--r--src/imports/controls/material/SliderHandle.qml4
-rw-r--r--src/imports/controls/material/qquickmaterialstyle.cpp7
-rw-r--r--src/imports/controls/material/qquickmaterialstyle_p.h2
5 files changed, 28 insertions, 17 deletions
diff --git a/src/imports/controls/material/RangeSlider.qml b/src/imports/controls/material/RangeSlider.qml
index d735573a..f05601a7 100644
--- a/src/imports/controls/material/RangeSlider.qml
+++ b/src/imports/controls/material/RangeSlider.qml
@@ -36,6 +36,7 @@
import QtQuick 2.12
import QtQuick.Templates 2.12 as T
+import QtQuick.Controls.impl 2.12
import QtQuick.Controls.Material 2.12
import QtQuick.Controls.Material.impl 2.12
@@ -74,18 +75,18 @@ T.RangeSlider {
y: control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : 0)
implicitWidth: control.horizontal ? 200 : 48
implicitHeight: control.horizontal ? 48 : 200
- width: control.horizontal ? control.availableWidth : 1
- height: control.horizontal ? 1 : control.availableHeight
- color: control.Material.foreground
- scale:control.horizontal && control.mirrored ? -1 : 1
+ width: control.horizontal ? control.availableWidth : 4
+ height: control.horizontal ? 4 : control.availableHeight
+ scale: control.horizontal && control.mirrored ? -1 : 1
+ color: control.enabled ? Color.transparent(control.Material.accentColor, 0.33) : control.Material.sliderDisabledColor
Rectangle {
- x: control.horizontal ? control.first.position * parent.width : -1
- y: control.horizontal ? -1 : control.second.visualPosition * parent.height + 3
- width: control.horizontal ? control.second.position * parent.width - control.first.position * parent.width - 3 : 3
- height: control.horizontal ? 3 : control.second.position * parent.height - control.first.position * parent.height - 3
+ x: control.horizontal ? control.first.position * parent.width : 0
+ y: control.horizontal ? 0 : control.second.visualPosition * parent.height
+ width: control.horizontal ? control.second.position * parent.width - control.first.position * parent.width : 4
+ height: control.horizontal ? 4 : control.second.position * parent.height - control.first.position * parent.height
- color: control.Material.accentColor
+ color: control.enabled ? control.Material.accentColor : control.Material.sliderDisabledColor
}
}
}
diff --git a/src/imports/controls/material/Slider.qml b/src/imports/controls/material/Slider.qml
index cc6a1413..ac7a0c42 100644
--- a/src/imports/controls/material/Slider.qml
+++ b/src/imports/controls/material/Slider.qml
@@ -36,6 +36,7 @@
import QtQuick 2.12
import QtQuick.Templates 2.12 as T
+import QtQuick.Controls.impl 2.12
import QtQuick.Controls.Material 2.12
import QtQuick.Controls.Material.impl 2.12
@@ -63,18 +64,18 @@ T.Slider {
y: control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : 0)
implicitWidth: control.horizontal ? 200 : 48
implicitHeight: control.horizontal ? 48 : 200
- width: control.horizontal ? control.availableWidth : 1
- height: control.horizontal ? 1 : control.availableHeight
- color: control.Material.foreground
+ width: control.horizontal ? control.availableWidth : 4
+ height: control.horizontal ? 4 : control.availableHeight
scale: control.horizontal && control.mirrored ? -1 : 1
+ color: control.enabled ? Color.transparent(control.Material.accentColor, 0.33) : control.Material.sliderDisabledColor
Rectangle {
x: control.horizontal ? 0 : (parent.width - width) / 2
y: control.horizontal ? (parent.height - height) / 2 : control.visualPosition * parent.height
- width: control.horizontal ? control.position * parent.width : 3
- height: control.horizontal ? 3 : control.position * parent.height
+ width: control.horizontal ? control.position * parent.width : 4
+ height: control.horizontal ? 4 : control.position * parent.height
- color: control.Material.accentColor
+ color: control.enabled ? control.Material.accentColor : control.Material.sliderDisabledColor
}
}
}
diff --git a/src/imports/controls/material/SliderHandle.qml b/src/imports/controls/material/SliderHandle.qml
index 2e3120e4..c9078bc8 100644
--- a/src/imports/controls/material/SliderHandle.qml
+++ b/src/imports/controls/material/SliderHandle.qml
@@ -55,8 +55,8 @@ Item {
width: parent.width
height: parent.height
radius: width / 2
- color: root.control.Material.accentColor
scale: root.handlePressed ? 1.5 : 1
+ color: control.enabled ? root.control.Material.accentColor : root.control.Material.sliderDisabledColor
Behavior on scale {
NumberAnimation {
@@ -71,6 +71,6 @@ Item {
width: 22; height: 22
pressed: root.handlePressed
active: root.handlePressed || root.handleHasFocus || root.handleHovered
- color: root.control.Material.rippleColor
+ color: root.control.Material.highlightedRippleColor
}
}
diff --git a/src/imports/controls/material/qquickmaterialstyle.cpp b/src/imports/controls/material/qquickmaterialstyle.cpp
index 77a65927..35afeb00 100644
--- a/src/imports/controls/material/qquickmaterialstyle.cpp
+++ b/src/imports/controls/material/qquickmaterialstyle.cpp
@@ -422,6 +422,8 @@ static const QRgb rippleColorLight = 0x10000000;
static const QRgb rippleColorDark = 0x20FFFFFF;
static const QRgb spinBoxDisabledIconColorLight = 0xFFCCCCCC;
static const QRgb spinBoxDisabledIconColorDark = 0xFF666666;
+static const QRgb sliderDisabledColorLight = 0xFF9E9E9E;
+static const QRgb sliderDisabledColorDark = 0xFF616161;
static QQuickMaterialStyle::Theme effectiveTheme(QQuickMaterialStyle::Theme theme)
{
@@ -1037,6 +1039,11 @@ QColor QQuickMaterialStyle::spinBoxDisabledIconColor() const
return QColor::fromRgba(m_theme == Light ? spinBoxDisabledIconColorLight : spinBoxDisabledIconColorDark);
}
+QColor QQuickMaterialStyle::sliderDisabledColor() const
+{
+ return QColor::fromRgba(m_theme == Light ? sliderDisabledColorLight : sliderDisabledColorDark);
+}
+
QColor QQuickMaterialStyle::color(QQuickMaterialStyle::Color color, QQuickMaterialStyle::Shade shade) const
{
int count = sizeof(colors) / sizeof(colors[0]);
diff --git a/src/imports/controls/material/qquickmaterialstyle_p.h b/src/imports/controls/material/qquickmaterialstyle_p.h
index 4b0f7b31..d2a89761 100644
--- a/src/imports/controls/material/qquickmaterialstyle_p.h
+++ b/src/imports/controls/material/qquickmaterialstyle_p.h
@@ -97,6 +97,7 @@ class QQuickMaterialStyle : public QQuickAttachedObject
Q_PROPERTY(QColor toolBarColor READ toolBarColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor toolTextColor READ toolTextColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor spinBoxDisabledIconColor READ spinBoxDisabledIconColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor sliderDisabledColor READ sliderDisabledColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(int touchTarget READ touchTarget CONSTANT FINAL)
Q_PROPERTY(int buttonHeight READ buttonHeight CONSTANT FINAL)
@@ -237,6 +238,7 @@ public:
QColor toolBarColor() const;
QColor toolTextColor() const;
QColor spinBoxDisabledIconColor() const;
+ QColor sliderDisabledColor() const;
Q_INVOKABLE QColor color(Color color, Shade shade = Shade500) const;
Q_INVOKABLE QColor shade(const QColor &color, Shade shade) const;