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->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
|
||||
|
Loading…
Reference in New Issue
Block a user