我想实现一个Slider使用 QtQuick.Controls 的地方,其中只有handle是可点击的并且可以用来拖动handle. 如果单击groove,则不会发生任何事情,handle应该保持原位。我怎样才能将 的 限制为mouseArea唯一的?Sliderhandle
在下面的示例中Slider,整个都是可点击的,Slider width并且height:
import QtQuick 2.4
import QtQuick.Window 2.2
import QtQuick.Controls 1.3
import QtQuick.Controls.Styles 1.3
Window {
id: mainItem
width: 800
height: 400
visible: true
Slider{
id: autoSlider
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
maximumValue: 1.0
value: 0
updateValueWhileDragging : false
style: SliderStyle {
groove: Rectangle {
implicitWidth: 350
implicitHeight: 8
color: "gray"
radius: 8
}
handle: Rectangle {
anchors.centerIn: parent
color: control.pressed ? "white" : "lightgray"
border.color: "gray"
border.width: 2
implicitWidth: 45
implicitHeight: 45
radius: 12
}
}
}
}
我想过更改Slider.qml“..\qml\QtQuick\Controls”文件夹中的模板,但我真的不知道该怎么做。
我所有的搜索努力都没有结果。任何帮助将不胜感激。