Move drag icon relative the cursor hotspot position
Instead of placing the drag icons top-left corner at the cursors hotspot the drag icon is moved so it will be placed correct relative the cursor hotspot. This will makes the drag feeling more realistic. Change-Id: I8d60ae1b7788accb9034575983417abae4c58c1a Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com> Reviewed-by: Johan Helsing <johan.helsing@qt.io>
This commit is contained in:
parent
f1bf4fc2c6
commit
c477d954ae
@ -74,6 +74,7 @@ void QWaylandDrag::startDrag()
|
|||||||
QBasicDrag::startDrag();
|
QBasicDrag::startDrag();
|
||||||
QWaylandWindow *icon = static_cast<QWaylandWindow *>(shapedPixmapWindow()->handle());
|
QWaylandWindow *icon = static_cast<QWaylandWindow *>(shapedPixmapWindow()->handle());
|
||||||
m_display->currentInputDevice()->dataDevice()->startDrag(drag()->mimeData(), icon);
|
m_display->currentInputDevice()->dataDevice()->startDrag(drag()->mimeData(), icon);
|
||||||
|
icon->addAttachOffset(-drag()->hotSpot());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandDrag::cancel()
|
void QWaylandDrag::cancel()
|
||||||
|
@ -905,6 +905,11 @@ void QWaylandWindow::requestUpdate()
|
|||||||
mUpdateRequested = true;
|
mUpdateRequested = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QWaylandWindow::addAttachOffset(const QPoint point)
|
||||||
|
{
|
||||||
|
mOffset += point;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -197,6 +197,7 @@ public:
|
|||||||
|
|
||||||
bool setKeyboardGrabEnabled(bool) Q_DECL_OVERRIDE { return false; }
|
bool setKeyboardGrabEnabled(bool) Q_DECL_OVERRIDE { return false; }
|
||||||
void propagateSizeHints() Q_DECL_OVERRIDE { }
|
void propagateSizeHints() Q_DECL_OVERRIDE { }
|
||||||
|
void addAttachOffset(const QPoint point);
|
||||||
|
|
||||||
void requestUpdate() Q_DECL_OVERRIDE;
|
void requestUpdate() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user