Skip to content
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

fix #291089: Leaving edit mode requires second click #5161

Merged
merged 1 commit into from
Jun 25, 2019

Conversation

mattmcclinch
Copy link
Contributor

@mattmcclinch mattmcclinch commented Jun 24, 2019

Resolves: https://musescore.org/en/node/291089.

On macOS and Linux, Qt never sends a mouse release event to the ScoreView for the right mouse button, and so editData.buttons is not reset to Qt::NoButton. Changing to text edit mode causes mouse tracking to be turned on, and editData.buttons is still equal to Qt::RightMouseButton, and so any subsequent mouse movement registers as a drag. This fixes the problem by setting editData.buttons to Qt::NoButton in ScoreView::contextMenuEvent().

@dmitrio95
Copy link
Contributor

I wonder whether we can get rid of editData.buttons at all, it seems to me the only thing that may keep us from doing so is its usage in TextBase.

It looks like this field was introduced in 186c680 where it was used as a replacement for QMouseEvent::button() result which is, according to Qt docs, always Qt::NoButton for mouse move events. However, the same documentation states that QMouseEvents::buttons() returns all the pressed buttons for mouse move events, so it shouldn't have the downside of QMouseEvent::button() which was probably the reason to introduce this field.

So the question is, would just replacing all checks for editData.buttons to something like mouseEvent->buttons() fix both 291089 and 291199 while retaining all the features introduced in #5101?

@mattmcclinch
Copy link
Contributor Author

As long as we are keeping editData.buttons, we should make sure that its value is correct. It is possible to retain all features introduced in #5101 by making sure that the left mouse button was the one that generated the press event, but there seems to be a debate over whether or not the “single click to enter text edit mode” feature is wanted after all.

@dmitrio95
Copy link
Contributor

Yes, but tracking it manually we have more chances to miss some other tricky case when we need to update this value. Of course, this commit can and should be merged for 3.2, but if the approach with using the information reported by QMouseEvent directly works correctly it would certainly be preferable to switch to that approach in the future.

@dmitrio95 dmitrio95 merged commit 38dab17 into musescore:master Jun 25, 2019
anatoly-os pushed a commit that referenced this pull request Jun 25, 2019
fix #291089: Leaving edit mode requires second click
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants