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. Why cursor is moved to 0,0 when I use setGeometry?
Forum Updated to NodeBB v4.3 + New Features

Why cursor is moved to 0,0 when I use setGeometry?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 186 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.
  • P Offline
    P Offline
    PawlosCK
    wrote on last edited by
    #1

    I want to press left mouse button and move window to other position. Generally everything is ok, but I don't know, why cursor is moved to position 0,0.

            onPositionChanged:
            {
                if (mouse.buttons == Qt.LeftButton)
                {
                    console.log("Mouse: X:Y: " + mouseX + ":" + mouseY)
                    console.log("Window: X:Y: " + mainWindow.x + ":" + mainWindow.y)
                    console.log(mapToGlobal(mouseX, mouseY))
    
                    var windowGeometry = mapToGlobal(mouseX, mouseY)
                    mainWindow.setGeometry(windowGeometry.x, windowGeometry.y , mainWindow.width, mainWindow.height)
    
                }
            }
    
    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