summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2011-09-22 17:28:04 +0200
committerQt by Nokia <qt-info@nokia.com>2011-09-28 03:17:07 +0200
commit009480275e0bfc471a7c315ac5f74e941c1e85ff (patch)
treebdc91a963dec25ec9eef34f57bb798345e4ba8dc
parent66f8be7b731c44fd1600c80298ba7710d4d06b6e (diff)
Use the drag cursor shapes
Correctly use the Qt::Drag* cursor shapes for drags. Still doesn't work as QGuiApp::setOverrideCursor needs an implementation. Change-Id: I60b6a647be03f3700408ee8afcfa631a18e2bcaf Reviewed-on: http://codereview.qt-project.org/5559 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
-rw-r--r--src/gui/kernel/qdnd.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/gui/kernel/qdnd.cpp b/src/gui/kernel/qdnd.cpp
index 9a90c213cf..b3aa206234 100644
--- a/src/gui/kernel/qdnd.cpp
+++ b/src/gui/kernel/qdnd.cpp
@@ -354,20 +354,21 @@ void QDragManager::updateCursor()
shapedPixmapWindow->render(); // ### Hack
shapedPixmapWindow->move(QCursor::pos() - shapedPixmapWindow->hotSpot);
}
-#ifndef QT_NO_CURSOR
+
+ Qt::CursorShape cursorShape = Qt::ForbiddenCursor;
if (willDrop) {
- if (currentActionForOverrideCursor != global_accepted_action) {
- QGuiApplication::changeOverrideCursor(QCursor(dragCursor(global_accepted_action), 0, 0));
- currentActionForOverrideCursor = global_accepted_action;
- }
- } else {
- QCursor *overrideCursor = QGuiApplication::overrideCursor();
- if (!overrideCursor || overrideCursor->shape() != Qt::ForbiddenCursor) {
- QGuiApplication::changeOverrideCursor(QCursor(Qt::ForbiddenCursor));
- currentActionForOverrideCursor = Qt::IgnoreAction;
+ if (global_accepted_action == Qt::CopyAction) {
+ cursorShape = Qt::DragCopyCursor;
+ } else if (global_accepted_action == Qt::LinkAction) {
+ cursorShape = Qt::DragLinkCursor;
+ } else {
+ cursorShape = Qt::DragMoveCursor;
}
}
-#endif
+ if (cursorShape != qApp->overrideCursor()->shape()) {
+ qDebug() << "setting cursor shape to" << cursorShape;
+ qApp->changeOverrideCursor(QCursor(cursorShape));
+ }
}
@@ -465,7 +466,7 @@ Qt::DropAction QDragManager::drag(QDrag *o)
global_accepted_action = Qt::CopyAction;
#ifndef QT_NO_CURSOR
- qApp->setOverrideCursor(Qt::ArrowCursor);
+ qApp->setOverrideCursor(Qt::DragCopyCursor);
restoreCursor = true;
updateCursor();
#endif