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>
This commit is contained in:
parent
66f8be7b73
commit
009480275e
@ -354,20 +354,21 @@ void QDragManager::updateCursor()
|
|||||||
shapedPixmapWindow->render(); // ### Hack
|
shapedPixmapWindow->render(); // ### Hack
|
||||||
shapedPixmapWindow->move(QCursor::pos() - shapedPixmapWindow->hotSpot);
|
shapedPixmapWindow->move(QCursor::pos() - shapedPixmapWindow->hotSpot);
|
||||||
}
|
}
|
||||||
#ifndef QT_NO_CURSOR
|
|
||||||
|
Qt::CursorShape cursorShape = Qt::ForbiddenCursor;
|
||||||
if (willDrop) {
|
if (willDrop) {
|
||||||
if (currentActionForOverrideCursor != global_accepted_action) {
|
if (global_accepted_action == Qt::CopyAction) {
|
||||||
QGuiApplication::changeOverrideCursor(QCursor(dragCursor(global_accepted_action), 0, 0));
|
cursorShape = Qt::DragCopyCursor;
|
||||||
currentActionForOverrideCursor = global_accepted_action;
|
} else if (global_accepted_action == Qt::LinkAction) {
|
||||||
}
|
cursorShape = Qt::DragLinkCursor;
|
||||||
} else {
|
} else {
|
||||||
QCursor *overrideCursor = QGuiApplication::overrideCursor();
|
cursorShape = Qt::DragMoveCursor;
|
||||||
if (!overrideCursor || overrideCursor->shape() != Qt::ForbiddenCursor) {
|
|
||||||
QGuiApplication::changeOverrideCursor(QCursor(Qt::ForbiddenCursor));
|
|
||||||
currentActionForOverrideCursor = Qt::IgnoreAction;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#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;
|
global_accepted_action = Qt::CopyAction;
|
||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
qApp->setOverrideCursor(Qt::ArrowCursor);
|
qApp->setOverrideCursor(Qt::DragCopyCursor);
|
||||||
restoreCursor = true;
|
restoreCursor = true;
|
||||||
updateCursor();
|
updateCursor();
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user