aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2022-07-01 16:00:40 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-08-06 13:19:52 +0000
commit77951ce927a0b2b1c1fae540be8d85368318e18d (patch)
treef3b605a6c8fa070e8eec0ade589d11469d72cd28
parent7e77b8e8dffb86a7b359d2aa72a5ca080e387121 (diff)
Native style, StyleItemScrollbar: don't draw the scrollbar as sunken when using an override state
When we specify an override state from QML, like NeverHovered, we also don't want the scrollbar to be drawn as pressed (sunken). The point with the override state is to lock the image to a certain state that doesn't change. This will fix a drawing issue on macOS, where the scrollbar becomes far too dark when you drag on it. Change-Id: I7f62e7ebd6d1ebbe808e035f63485ed292661bc1 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io> (cherry picked from commit 5a8ac8f3d57c5381afb6a4d79990b0d7a5298936) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/quicknativestyle/items/qquickstyleitemscrollbar.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/quicknativestyle/items/qquickstyleitemscrollbar.cpp b/src/quicknativestyle/items/qquickstyleitemscrollbar.cpp
index 32e7066836..c328ab6d1f 100644
--- a/src/quicknativestyle/items/qquickstyleitemscrollbar.cpp
+++ b/src/quicknativestyle/items/qquickstyleitemscrollbar.cpp
@@ -101,8 +101,10 @@ void QQuickStyleItemScrollBar::initStyleOption(QStyleOptionSlider &styleOption)
// the handle, depending on if it's hovered or not
if (m_overrideState == AlwaysHovered) {
+ styleOption.state &= ~QStyle::State_Sunken;
styleOption.activeSubControls = (styleOption.subControls & (QStyle::SC_ScrollBarSlider | QStyle::SC_ScrollBarGroove | QStyle::SC_ScrollBarAddLine | QStyle::SC_ScrollBarSubLine));
} else if (m_overrideState == NeverHovered) {
+ styleOption.state &= ~QStyle::State_Sunken;
styleOption.activeSubControls &= ~(styleOption.subControls & (QStyle::SC_ScrollBarSlider | QStyle::SC_ScrollBarGroove | QStyle::SC_ScrollBarAddLine | QStyle::SC_ScrollBarSubLine));
} else if (m_overrideState == AlwaysSunken) {
styleOption.state |= QStyle::State_Sunken;