Revert value label for the Qt Quick Controls Material slider

The SliderHandle was changed in 0ac8eb67ea
to display the current value of the slider, while the SliderHandle was
being pressed.

This feature should be optional, and we currently don't have a nice API
for hiding it.

Let's look for a way to introduce this feature in Qt 6.6 instead.

Task-number: QTBUG-111355
Pick-to: 6.5 6.5.0
Change-Id: I3c3f240839d1b69c0fea32d59c8abc8e64e1a184
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
This commit is contained in:
Oliver Eftevaag 2023-03-16 11:33:39 +01:00 committed by Mitch Curtis
parent 18b4a5ceef
commit 2fcb336698
1 changed files with 0 additions and 44 deletions

View File

@ -35,48 +35,4 @@ Item {
active: root.handlePressed || root.handleHasFocus || (enabled && root.handleHovered)
color: root.control ? root.control.Material.highlightedRippleColor : "transparent"
}
Rectangle {
anchors.bottom: parent.top
anchors.bottomMargin: 6
anchors.horizontalCenter: parent.horizontalCenter
scale: root.handlePressed ? 1 : 0
implicitWidth: Math.max(tm.width + 8, height)
implicitHeight: tm.height + 8
radius: height / 2
color: root.control ? root.control.Material.accentColor : "transparent"
transformOrigin: Item.Bottom
Behavior on scale {
NumberAnimation {
duration: 100
}
}
Rectangle {
anchors.top: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
// Center the square to the parent circle, then position it downwards by half of the diagonal
anchors.topMargin: Math.floor(-parent.radius * 1.5 + Math.sqrt(parent.radius * parent.radius / 2))
implicitWidth: parent.radius
implicitHeight: parent.radius
rotation: 45
color: root.control ? root.control.Material.accentColor : "transparent"
}
TextMetrics {
id: tm
text: '8'.repeat(label.text.length)
font: label.font
}
Text {
id: label
anchors.centerIn: parent
text: Math.abs(Math.floor(value) - value.toFixed(2)) < Number.EPSILON ? Math.trunc(value) : value.toFixed(2)
color: root.control ? root.control.Material.primaryHighlightedTextColor : "transparent"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
}