Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Slider, handle and mouse cursor
Forum Updated to NodeBB v4.3 + New Features

Slider, handle and mouse cursor

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 1 Posters 855 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SteveMSS Offline
    SteveMSS Offline
    SteveMS
    wrote on last edited by
    #1

    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 handle

    width: 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.

    1 Reply Last reply
    0
    • SteveMSS Offline
      SteveMSS Offline
      SteveMS
      wrote on last edited by SteveMS
      #2

      Apparently, it seems to be a bug so I reported it on Qt bugreports.
      https://bugreports.qt.io/browse/QTBUG-51953

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved