Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to get current cursor position into QML

How to get current cursor position into QML

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 3.5k Views 1 Watching
  • 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.
  • I Offline
    I Offline
    inblueswithu
    wrote on last edited by
    #1

    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.

    Regards,
    inblueswithu

    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