QML Drag Outside of Window

  • I have a simple rectangle that drags on the x axis. My window size is 800x480.

    I have a white Rectangle that is able to drag on the X axis. When pressed (onPressed) the Rectangle changes to red and drags along the X axis. If the mouse goes outside the window my onReleased signal does not fire nor does the drag ever resume when the mouse enters the window again, Thus the rectangle is still Red.

    Is there any way that I can pickup if the mouse leaves the window?

    Thank you

  • I have a exact situation with QtQuick2. are u using this version?

  • Yup

  • And did u embed qwindow into qwidget?

  • I am just using QtQuick2ApplicationViewer. My app only has one window.

    One way to get around this would be to implement your own cursor exit signal. I was thinking that I could use QCursor::pos and see when the cursor goes outside the window. QCursor::pos returns the global screen coordinates though.

    I haven't tested it yet, but will update once I do.

    Let me know if you have any ideas.


  • I've used qtquick2.0 and embed it in QWidget and i had the same bug as yours. I've tried so much and even opened a page in QtBugReport. Now my problem is resolved in Qt 5.1.0 (I've cloned it from git). As i know the time of next major release is close, but if you haven't that time you can get the latest stable Qt5 from git.

  • Just cloned it.

    Thanks a lot

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.