summaryrefslogtreecommitdiffstats
path: root/src/platformsupport
diff options
context:
space:
mode:
authorCyril Oblikov <munknex@gmail.com>2012-09-27 17:55:16 +0300
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-26 17:08:03 +0200
commit38e02188ee132fd8c483fcb9773979875677c070 (patch)
treed955d6be7d03505c049664c069c8a2027eb9c999 /src/platformsupport
parent80e87c0241fb2b82e4f44ce7228764514ddb00e5 (diff)
Possibility to change custom Drag&Drop cursors while dragging something. Implementation for Windows and X11.
Additional checks to figure out if new Drag&Drop cursors where set. This means it is possible now to keep QDrag object in your program and call setDragCursor() method every time we need to change cursor depending on context. Change-Id: I4be69e44b2863371a7ffbb29efc17c18210d6cde Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Gatis Paeglis <gatis.paeglis@digia.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'src/platformsupport')
-rw-r--r--src/platformsupport/dnd/qsimpledrag.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/platformsupport/dnd/qsimpledrag.cpp b/src/platformsupport/dnd/qsimpledrag.cpp
index d8ef17ede3..18e6b97e3c 100644
--- a/src/platformsupport/dnd/qsimpledrag.cpp
+++ b/src/platformsupport/dnd/qsimpledrag.cpp
@@ -253,8 +253,19 @@ void QBasicDrag::updateCursor(Qt::DropAction action)
}
QCursor *cursor = qApp->overrideCursor();
- if (cursor && cursorShape != cursor->shape()) {
- qApp->changeOverrideCursor(QCursor(cursorShape));
+ QPixmap pixmap = m_drag->dragCursor(action);
+ if (!cursor) {
+ qApp->changeOverrideCursor((pixmap.isNull()) ? QCursor(cursorShape) : QCursor(pixmap));
+ } else {
+ if (!pixmap.isNull()) {
+ if ((cursor->pixmap().cacheKey() != pixmap.cacheKey())) {
+ qApp->changeOverrideCursor(QCursor(pixmap));
+ }
+ } else {
+ if (cursorShape != cursor->shape()) {
+ qApp->changeOverrideCursor(QCursor(cursorShape));
+ }
+ }
}
updateAction(action);
}