aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicknativestyle/controls/DefaultSlider.qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/quicknativestyle/controls/DefaultSlider.qml')
-rw-r--r--src/quicknativestyle/controls/DefaultSlider.qml43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/quicknativestyle/controls/DefaultSlider.qml b/src/quicknativestyle/controls/DefaultSlider.qml
new file mode 100644
index 0000000000..52f123a432
--- /dev/null
+++ b/src/quicknativestyle/controls/DefaultSlider.qml
@@ -0,0 +1,43 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Templates as T
+import QtQuick.NativeStyle as NativeStyle
+
+T.Slider {
+ id: control
+
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitHandleWidth + leftPadding + rightPadding,
+ control.horizontal ? 90 : 0 /* minimum */ )
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitHandleHeight + topPadding + bottomPadding,
+ control.vertical ? 90 : 0 /* minimum */ )
+
+ readonly property bool __notCustomizable: true
+
+ background: NativeStyle.Slider {
+ control: control
+ subControl: NativeStyle.Slider.Groove
+ // 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
+
+ readonly property bool __ignoreNotCustomizable: true
+ }
+
+ handle: NativeStyle.Slider {
+ 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
+
+ readonly property bool __ignoreNotCustomizable: true
+ }
+}