New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selected object drag cursor #1277

Closed
Yanrishatum opened this Issue May 15, 2016 · 4 comments

Comments

Projects
None yet
2 participants
@Yanrishatum

Yanrishatum commented May 15, 2016

When hovering over on not selected object, it shows drag cursor, after clicking on it and moving cursor out of it AND on the way hover over any of object resize/rotation controls cursor will remain as drag cursor.
Gif for clarity, because I'm bad at explaining:
Bug reproduction
Version: Tiled 0.16.0 and 0.16.1.

@bjorn bjorn added the bug label May 15, 2016

@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn May 15, 2016

Owner

Unfortunately this appears to be a bug in Qt. When tracing the code, I can see Tiled is setting the arrow cursor on the viewport as soon as you exit the hovered handle, but it changes back to the hand cursor instead.

So I think I could either dig into Qt to see if I can find out where it goes wrong, or I can change the handle implementation to avoid this scenario. The latter is probably easier...

Owner

bjorn commented May 15, 2016

Unfortunately this appears to be a bug in Qt. When tracing the code, I can see Tiled is setting the arrow cursor on the viewport as soon as you exit the hovered handle, but it changes back to the hand cursor instead.

So I think I could either dig into Qt to see if I can find out where it goes wrong, or I can change the handle implementation to avoid this scenario. The latter is probably easier...

@bjorn bjorn added the qt issue label May 15, 2016

@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn May 15, 2016

Owner

Alright, looking at the Qt code in qgraphicsview.cpp, it's indeed an issue resulting from their implementation for item-specific cursors, and I don't see an easy fix. What seems to happen is:

  1. When you hover an object, I set the viewport mouse cursor to the movement cursor.
  2. When you then go on the handle, Qt saves the current viewport mouse cursor (the movement cursor) and replaces the viewport cursor with the arrow cursor associated with the handle.
  3. When you exit the handle and are no longer hovering an object, I set the viewport mouse cursor back to the arrow cursor.
  4. Since you're no longer on top of the handle item, Qt now restores the viewport mouse cursor to the one it had previously saved (the movement cursor).

I'd love to swap the order on the last two items above, but my logic happens in response to mouse events delivered to the QGraphicsScene, and the QGraphicsView sends that event first and then goes on to do its mouse cursor logic.

So, the alternative is to stop setting a mouse cursor on the handles and do all the updating only in the object selection tool. That means it will also need to take care of setting the hovered state on the handles, but that should be no problem.

Owner

bjorn commented May 15, 2016

Alright, looking at the Qt code in qgraphicsview.cpp, it's indeed an issue resulting from their implementation for item-specific cursors, and I don't see an easy fix. What seems to happen is:

  1. When you hover an object, I set the viewport mouse cursor to the movement cursor.
  2. When you then go on the handle, Qt saves the current viewport mouse cursor (the movement cursor) and replaces the viewport cursor with the arrow cursor associated with the handle.
  3. When you exit the handle and are no longer hovering an object, I set the viewport mouse cursor back to the arrow cursor.
  4. Since you're no longer on top of the handle item, Qt now restores the viewport mouse cursor to the one it had previously saved (the movement cursor).

I'd love to swap the order on the last two items above, but my logic happens in response to mouse events delivered to the QGraphicsScene, and the QGraphicsView sends that event first and then goes on to do its mouse cursor logic.

So, the alternative is to stop setting a mouse cursor on the handles and do all the updating only in the object selection tool. That means it will also need to take care of setting the hovered state on the handles, but that should be no problem.

@bjorn bjorn self-assigned this May 15, 2016

@bjorn bjorn closed this in 9f41e5c May 16, 2016

@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn May 16, 2016

Owner

I will see your bug report and raise you a number of other improvements on top! :-)

Owner

bjorn commented May 16, 2016

I will see your bug report and raise you a number of other improvements on top! :-)

@Yanrishatum

This comment has been minimized.

Show comment
Hide comment
@Yanrishatum

Yanrishatum May 16, 2016

Thank you. :)

Yanrishatum commented May 16, 2016

Thank you. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment