Unsolved Slider, handle and mouse cursor
-
Hi.
I created a simple default Qt Quick project.ApplicationWindow { visible: true width: 640 height: 480 title: qsTr("Hello World") menuBar: MenuBar { Menu { title: qsTr("File") MenuItem { text: qsTr("&Open") onTriggered: console.log("Open action triggered"); } MenuItem { text: qsTr("Exit") onTriggered: Qt.quit(); } } } MySlider{ id: myslider } }
With MySlider.qml :
Item { id: itemSlider x: 0 y: 0 width: 200 height: 300 Rectangle { id: background width: 200 height: 300 color:Qt.rgba(0.2,0.2,0.2,1); } Slider { id:slider orientation: Qt.Vertical width: 200 height: 300 anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter style: SliderStyle { groove: Rectangle { width: 300 height: 2 color: Qt.rgba(1,0,0,1); } handle: Rectangle { anchors.centerIn: parent color: Qt.rgba(0.7,0.7,0.7,1); width: 10 height: 10 } } } }
If I put the next values for the handle
width: 10 height: 10
then, when I move the handle it stays Under the mouse cursor.
However if I put the next values to have a flattened handlewidth: 10 height: 100 //the greater the value is, the greater the offset between the handle and the mouse cursor is
then the handle doesn't follow the mouse cursor, there is an offset between the two.
What is the problem? Is it a bug?
Thanks. -
Apparently, it seems to be a bug so I reported it on Qt bugreports.
https://bugreports.qt.io/browse/QTBUG-51953