Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
6.2.0, 6.2.4, 6.3.0 RC
-
cda435941e (qt/qtdeclarative/dev) cda435941e (qt/tqtc-qtdeclarative/dev) 5be302fa9b (qt/qtdeclarative/6.4)
Description
This uses a slightly modified version of the example at
https://doc.qt.io/qt-6/qtquickcontrols2-customize.html#customizing-slider
import QtQuick 2.15 import QtQuick.Window 2.15 import QtQuick.Controls 2.15 Window { width: 640 height: 80 visible: true Slider { id: control value: 0.5 anchors.fill: parent background: Rectangle { x: control.leftPadding y: control.topPadding + control.availableHeight / 2 - height / 2 // implicitWidth: 200 implicitHeight: 4 width: control.availableWidth height: implicitHeight radius: 2 color: "#bdbebf" Rectangle { width: control.visualPosition * parent.width height: parent.height color: "#21be2b" radius: 2 } } handle: Rectangle { x: control.leftPadding + control.visualPosition * (control.availableWidth - width) y: control.topPadding + control.availableHeight / 2 - height / 2 implicitWidth: 26 implicitHeight: 26 radius: 13 color: control.pressed ? "#f0f0f0" : "#f6f6f6" border.color: "#bdbebf" } } }
Outcomes
- Qt 5.15 produces slider-custom-bg-correct.png
- Qt 6.x produces slider-custom-bg-wrong.png
Workarounds
Either of these actions will produce slider-custom-bg-correct.png in Qt 6.x:
- Replace "anchors.fill: parent" with "width: parent.width; height: parent.height", OR
- Explicitly specify an implicitWidth
Side comments
Calling the skinny slide the `background` isn't intuitive. Really, `background` should refer to the "bounding rect" while the skinny slide should be a separate item called `groove` (for consistency with QSlider).
Attachments
Issue Links
- mentioned in
-
Page Loading...