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) Drag'n'drop: avoid unintended drag on hover (WTrackProperty, WCoverArt etc.) #13035

Merged
merged 1 commit into from
Apr 5, 2024

Conversation

ronso0
Copy link
Member

@ronso0 ronso0 commented Apr 1, 2024

Fixes #13033 on Linux with Qt 6.2.3

@ronso0
Copy link
Member Author

ronso0 commented Apr 1, 2024

@m0dB Do you have any idea what's going on?
Can someone reproduce with a Qt version other than 6.2.3?

@ronso0 ronso0 added this to the 2.5-beta milestone Apr 1, 2024
@ronso0 ronso0 added the skins label Apr 1, 2024
@ronso0
Copy link
Member Author

ronso0 commented Apr 1, 2024

Meeh, breaks dnd in the tracks table... wtf

@daschuer
Copy link
Member

daschuer commented Apr 1, 2024

I think it is an issue that in mouseMoveInitiatesDragHelper()

    static qreal pressX{};
    static qreal pressY{};

are static and are never reset.
Any mouse move initializes the drag event than.

@daschuer
Copy link
Member

daschuer commented Apr 1, 2024

I am able to reproduce it without a hover effect.

@ronso0
Copy link
Member Author

ronso0 commented Apr 1, 2024

Okay, thanks.

However it's different with WTracktableView:
no unintented drag in the first place, but:
on drag, the event catched by mouseMoveEvent doesn't have a button flag (Qt::NoButton).

@daschuer
Copy link
Member

daschuer commented Apr 1, 2024

Before #12903, the check for the pressed button was in the mouseMoveEvent() of each widget. Maybe we want to reintroduce it.

@ronso0
Copy link
Member Author

ronso0 commented Apr 1, 2024

I think it is an issue that in mouseMoveInitiatesDragHelper()

    static qreal pressX{};
    static qreal pressY{};

are static and are never reset. Any mouse move initializes the drag event than.

Appearantly. I managed to suppress unintented drag by initializing them both with -1.
We could reset on click release.

Turns out I don't fully understand the combination of static function + namespace inline function with static var.

@daschuer
Copy link
Member

daschuer commented Apr 1, 2024

These static vars are like globals, hidden in a function scope.

@ronso0
Copy link
Member Author

ronso0 commented Apr 1, 2024

However it's different with WTracktableView: no unintented drag in the first place, but: on drag, the event catched by mouseMoveEvent doesn't have a button flag (Qt::NoButton).

Uff, there's a difference between
QMouseEvent::button() == Qt::LeftButton return false
QMouseEvent::buttons() == Qt::LeftButton return true
QMouseEvent::button().testFlag(Qt::LeftButton) return true

edit at least for mouse moves.

@ronso0
Copy link
Member Author

ronso0 commented Apr 1, 2024

Works as expected with all track widgets and the table.

@ronso0 ronso0 changed the title Drag'n'drop: avoid unintended drag on hover (fix) Drag'n'drop: avoid unintended drag on hover (WTrackProperty, WCoverArt etc.) Apr 1, 2024
@ronso0
Copy link
Member Author

ronso0 commented Apr 1, 2024

I think it is an issue that in mouseMoveInitiatesDragHelper()

    static qreal pressX{};
    static qreal pressY{};

are static and are never reset. Any mouse move initializes the drag event than.

Turns out that doesn't matter with the correct button filter.

@ronso0
Copy link
Member Author

ronso0 commented Apr 4, 2024

@mixxxdj/developers Could someone take a look please?
After merging #11755 (with WTrackProperty:hover) main is broken for me (#13033).

Drag'n'drop should work as expected and no unintended drag must occur.
Test hover/drag with
WTrackProperty
WTrackWidgetGroup (track color lines in LateNight)
tracks table
cover art (decks and library)

@m0dB
Copy link
Contributor

m0dB commented Apr 4, 2024

I'll take a look when I have a moment, hopefully tonight (CET).

@m0dB m0dB merged commit 3546e22 into mixxxdj:main Apr 5, 2024
13 checks passed
@m0dB
Copy link
Contributor

m0dB commented Apr 5, 2024

LGTM, merged. Thanks for taking care of this while I was away.

@ronso0 ronso0 deleted the dnd-hover-fix branch April 5, 2024 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

instant drag on hover (mouse not pressed)
3 participants