diff --git a/src/util/dnd.cpp b/src/util/dnd.cpp index 7dd67dadd6f2..7363293b9f87 100644 --- a/src/util/dnd.cpp +++ b/src/util/dnd.cpp @@ -102,6 +102,13 @@ bool allowLoadToPlayer( // Helper function for DragAndDropHelper::mousePressed and DragAndDropHelper::mouseMoveInitiatesDrag bool mouseMoveInitiatesDragHelper(QMouseEvent* pEvent, bool isPress) { + // Only act if left button is pressed (click or drag). + // Works around some strange Qt bug where drag is initiated instantly on hover + // without any prior click. Reproducible with WCoverArt and WTrackProperty / + // WTrackWidgetGroup (only if :hover selector is added to the skin stylesheet). + if (pEvent->button() != Qt::LeftButton) { + return false; + } #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) const qreal x = pEvent->position().x(); const qreal y = pEvent->position().y(); @@ -209,9 +216,7 @@ bool DragAndDropHelper::allowDeckCloneAttempt( // static void DragAndDropHelper::mousePressed(QMouseEvent* pEvent) { - if (pEvent->button() == Qt::LeftButton) { - mouseMoveInitiatesDragHelper(pEvent, true); - } + mouseMoveInitiatesDragHelper(pEvent, true); } // static