Important: Please read the Qt Code of Conduct -

How to get current cursor position into QML

  • Hi,

    My idea is simple. I want a custom cursor with in my application. But this cursor is a QML component. So, it cant be done using QCursor().
    Someone suggested me to use Qt::BlankCursor to make the cursor invisible & then palace the QML component over cursor position.
    So, I want the cursor position fed to QML.

    I tried following ways

    • Making cursor object into context memory but the x,y values of cursor changes over time which the QML application could not get.
    • We can have a mouse area all over the application and get it as this:
      @x: mouseArea.mouseX - width/2
      y: mouseArea.mouseY - width/2@
      But this mouse area will overlap with other mouse areas inside the app & application wont work.

    Can someone please help me resolve this.

    NOTE: It would be great to have a platform independent solution.


Log in to reply