diff --git a/widgets/icon.cpp b/widgets/icon.cpp index 6647ea527..dc38fdc07 100644 --- a/widgets/icon.cpp +++ b/widgets/icon.cpp @@ -968,6 +968,8 @@ void Icon::mouseMoveEvent(QGraphicsSceneMouseEvent *event) update(); } } + + d->states |= Private::MovedState; } void Icon::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) @@ -987,6 +989,11 @@ void Icon::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) } } + if (d->states & Private::MovedState) { + d->states &= ~Private::MovedState; + handled = true; + } + if (!handled) { if (boundingRect().contains(event->pos())) { emit clicked(); diff --git a/widgets/icon_p.h b/widgets/icon_p.h index c35413652..438cb5c8e 100644 --- a/widgets/icon_p.h +++ b/widgets/icon_p.h @@ -97,7 +97,8 @@ public: NoState = 0, HoverState = 1, PressedState = 2, - ManualPressedState = 4 + ManualPressedState = 4, + MovedState = 8 }; Q_DECLARE_FLAGS(IconStates, IconState)