aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/controls/macos/Slider.qml25
-rw-r--r--src/imports/nativestyle/items/qquickstyleitemslider.cpp6
2 files changed, 30 insertions, 1 deletions
diff --git a/src/imports/controls/macos/Slider.qml b/src/imports/controls/macos/Slider.qml
index e8e0e036..77543577 100644
--- a/src/imports/controls/macos/Slider.qml
+++ b/src/imports/controls/macos/Slider.qml
@@ -38,6 +38,31 @@ import QtQuick
import QtQuick.NativeStyle as NativeStyle
NativeStyle.DefaultSlider {
+ id: control
readonly property Item __focusFrameTarget: handle
readonly property Item __focusFrameStyleItem: handle
+
+ background: NativeStyle.Slider {
+ control: control
+ subControl: NativeStyle.Slider.Groove | NativeStyle.Slider.Handle
+ // We normally cannot use a nine patch image for the
+ // groove if we draw tickmarks (since then the scaling
+ // would scale the tickmarks too). The groove might
+ // also use a different background color before, and
+ // after, the handle.
+ useNinePatchImage: false
+ }
+
+ handle: NativeStyle.Slider {
+ // The handle is hidden, since it will be drawn as a part
+ // of the background. But will still needs it to be here so
+ // that we can place the focus rect correctly.
+ visible: false
+
+ control: control
+ subControl: NativeStyle.Slider.Handle
+ x: control.leftPadding + (control.horizontal ? control.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2)
+ y: control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : control.visualPosition * (control.availableHeight - height))
+ useNinePatchImage: false
+ }
}
diff --git a/src/imports/nativestyle/items/qquickstyleitemslider.cpp b/src/imports/nativestyle/items/qquickstyleitemslider.cpp
index 6f8ec31f..0d226c02 100644
--- a/src/imports/nativestyle/items/qquickstyleitemslider.cpp
+++ b/src/imports/nativestyle/items/qquickstyleitemslider.cpp
@@ -82,7 +82,11 @@ void QQuickStyleItemSlider::initStyleOption(QStyleOptionSlider &styleOption)
initStyleOptionBase(styleOption);
auto slider = control<QQuickSlider>();
- styleOption.subControls = m_subControl == Groove ? QStyle::SC_SliderGroove : QStyle::SC_SliderHandle;
+ styleOption.subControls = QStyle::SC_None;
+ if (m_subControl & Groove)
+ styleOption.subControls |= QStyle::SC_SliderGroove;
+ if (m_subControl & Handle)
+ styleOption.subControls |= QStyle::SC_SliderHandle;
styleOption.activeSubControls = QStyle::SC_None;
styleOption.orientation = slider->orientation();