diff options
author | Liang Qi <liang.qi@qt.io> | 2016-06-01 13:18:06 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-06-01 13:19:21 +0200 |
commit | 14e08bafc88824f3d16602b04b5e60ae8c4005b0 (patch) | |
tree | 47a831782fe60e26e6bba7ff8e5a0c3ac0a81c42 /src/imports/controls/material | |
parent | 2ebb1fdcafaba9d3b0e7fbb42ccd5c3ffde38fbf (diff) | |
parent | ceaf6177a8be6db22e629ff05a625e278025b071 (diff) |
Merge remote-tracking branch 'origin/5.7' into dev
Comparing colors in tst_material.qml works fine now.
Conflicts:
examples/quickcontrols2/gallery/qtquickcontrols2.conf
tests/auto/material/data/tst_material.qml
Task-number: QTBUG-53556
Change-Id: I59970442a09bd72bf0ce53fe838c560ca8daf325
Diffstat (limited to 'src/imports/controls/material')
-rw-r--r-- | src/imports/controls/material/CheckIndicator.qml | 26 | ||||
-rw-r--r-- | src/imports/controls/material/ElevationEffect.qml | 2 | ||||
-rw-r--r-- | src/imports/controls/material/SpinBox.qml | 6 | ||||
-rw-r--r-- | src/imports/controls/material/qquickmaterialstyle.cpp | 17 | ||||
-rw-r--r-- | src/imports/controls/material/qquickmaterialstyle_p.h | 2 |
5 files changed, 42 insertions, 11 deletions
diff --git a/src/imports/controls/material/CheckIndicator.qml b/src/imports/controls/material/CheckIndicator.qml index c541e221..f64ca168 100644 --- a/src/imports/controls/material/CheckIndicator.qml +++ b/src/imports/controls/material/CheckIndicator.qml @@ -42,7 +42,7 @@ Rectangle { implicitWidth: 18 implicitHeight: 18 color: "transparent" - border.color: control.checked ? control.Material.accentColor : control.Material.secondaryTextColor + border.color: control.checked && control.enabled ? control.Material.accentColor : control.Material.secondaryTextColor border.width: control.checked ? width / 2 : 2 radius: 2 @@ -81,15 +81,31 @@ Rectangle { source: "qrc:/qt-project.org/imports/QtQuick/Controls.2/Material/images/check.png" fillMode: Image.PreserveAspectFit - scale: control.checked ? 1 : 0 + scale: control.checkState === Qt.Checked ? 1 : 0 Behavior on scale { NumberAnimation { duration: 100 } } } - states: State { - name: "checked" - when: control.checked + Rectangle { + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + width: 12 + height: 3 + + scale: control.checkState === Qt.PartiallyChecked ? 1 : 0 + Behavior on scale { NumberAnimation { duration: 100 } } } + states: [ + State { + name: "checked" + when: control.checkState === Qt.Checked + }, + State { + name: "partiallychecked" + when: control.checkState === Qt.PartiallyChecked + } + ] + transitions: Transition { SequentialAnimation { NumberAnimation { diff --git a/src/imports/controls/material/ElevationEffect.qml b/src/imports/controls/material/ElevationEffect.qml index 93a32f83..4ee4369c 100644 --- a/src/imports/controls/material/ElevationEffect.qml +++ b/src/imports/controls/material/ElevationEffect.qml @@ -215,7 +215,7 @@ Item { The current shadow based on the elevation. */ - readonly property var _shadow: _shadows[elevation] + readonly property var _shadow: _shadows[Math.max(0, Math.min(elevation, _shadows.length - 1))] // Nest the shadows and source view in two items rendered as a layer // so the shadow is not clipped by the bounds of the source view diff --git a/src/imports/controls/material/SpinBox.qml b/src/imports/controls/material/SpinBox.qml index e007013b..567fbfe5 100644 --- a/src/imports/controls/material/SpinBox.qml +++ b/src/imports/controls/material/SpinBox.qml @@ -126,14 +126,14 @@ T.SpinBox { y: (parent.height - height) / 2 width: Math.min(parent.width / 3, parent.width / 3) height: 2 - color: control.Material.primaryTextColor + color: enabled ? control.Material.primaryTextColor : control.Material.spinBoxDisabledIconColor } Rectangle { x: (parent.width - width) / 2 y: (parent.height - height) / 2 width: 2 height: Math.min(parent.width / 3, parent.width / 3) - color: control.Material.primaryTextColor + color: enabled ? control.Material.primaryTextColor : control.Material.spinBoxDisabledIconColor } } //! [up.indicator] @@ -156,7 +156,7 @@ T.SpinBox { y: (parent.height - height) / 2 width: parent.width / 3 height: 2 - color: control.Material.primaryTextColor + color: enabled ? control.Material.primaryTextColor : control.Material.spinBoxDisabledIconColor } } //! [down.indicator] diff --git a/src/imports/controls/material/qquickmaterialstyle.cpp b/src/imports/controls/material/qquickmaterialstyle.cpp index 8ad1ba66..76d81e5f 100644 --- a/src/imports/controls/material/qquickmaterialstyle.cpp +++ b/src/imports/controls/material/qquickmaterialstyle.cpp @@ -415,6 +415,8 @@ static const QRgb switchDisabledTrackColorLight = 0x1E000000; static const QRgb switchDisabledTrackColorDark = 0x19FFFFFF; static const QRgb checkBoxUncheckedRippleColorLight = 0x10000000; static const QRgb checkBoxUncheckedRippleColorDark = 0x20FFFFFF; +static const QRgb spinBoxDisabledIconColorLight = 0xFFCCCCCC; +static const QRgb spinBoxDisabledIconColorDark = 0xFF666666; static QColor alphaBlend(const QColor &bg, const QColor &fg) { @@ -574,7 +576,10 @@ void QQuickMaterialStyle::resetPrimary() m_customPrimary = false; m_explicitPrimary = false; QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(parentStyle()); - inheritPrimary(material ? material->m_primary : defaultPrimary, true); + if (material) + inheritPrimary(material->m_primary, material->m_customPrimary); + else + inheritPrimary(defaultPrimary, false); } QVariant QQuickMaterialStyle::accent() const @@ -630,7 +635,10 @@ void QQuickMaterialStyle::resetAccent() m_customAccent = false; m_explicitAccent = false; QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(parentStyle()); - inheritAccent(material ? material->m_accent : defaultAccent, true); + if (material) + inheritAccent(material->m_accent, material->m_customAccent); + else + inheritAccent(defaultAccent, false); } QVariant QQuickMaterialStyle::foreground() const @@ -1073,6 +1081,11 @@ QColor QQuickMaterialStyle::toolTextColor() const return primaryTextColor(); } +QColor QQuickMaterialStyle::spinBoxDisabledIconColor() const +{ + return QColor::fromRgba(m_theme == Light ? spinBoxDisabledIconColorLight : spinBoxDisabledIconColorDark); +} + 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 2686d14b..59858a5e 100644 --- a/src/imports/controls/material/qquickmaterialstyle_p.h +++ b/src/imports/controls/material/qquickmaterialstyle_p.h @@ -104,6 +104,7 @@ class QQuickMaterialStyle : public QQuickStyleAttached Q_PROPERTY(QColor listHighlightColor READ listHighlightColor NOTIFY paletteChanged FINAL) Q_PROPERTY(QColor tooltipColor READ tooltipColor NOTIFY paletteChanged FINAL) Q_PROPERTY(QColor toolTextColor READ toolTextColor NOTIFY paletteChanged FINAL) + Q_PROPERTY(QColor spinBoxDisabledIconColor READ spinBoxDisabledIconColor NOTIFY paletteChanged FINAL) public: enum Theme { @@ -232,6 +233,7 @@ public: QColor listHighlightColor() const; QColor tooltipColor() const; QColor toolTextColor() const; + QColor spinBoxDisabledIconColor() const; Q_INVOKABLE QColor color(Color color, Shade shade = Shade500) const; Q_INVOKABLE QColor shade(const QColor &color, Shade shade) const; |