Restore cursor before sending QDropEvent
When users created a modal window in a dropEvent(QDropEvent* event), the cursor was not restored to its original shape until after the modal window had been dismissed. Change-Id: Id4723e3cb66b36a3ca18ff097a3993563816d9e1 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
parent
29b9b92f40
commit
a77e4ea207
@ -140,7 +140,6 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e)
|
||||
QKeyEvent *ke = static_cast<QKeyEvent *>(e);
|
||||
if (ke->key() == Qt::Key_Escape && e->type() == QEvent::KeyPress) {
|
||||
cancel();
|
||||
resetDndState(true);
|
||||
disableEventFilter();
|
||||
exitDndEventLoop();
|
||||
|
||||
@ -154,13 +153,10 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e)
|
||||
|
||||
case QEvent::MouseButtonRelease:
|
||||
disableEventFilter();
|
||||
|
||||
if (canDrop()) {
|
||||
drop(static_cast<QMouseEvent *>(e));
|
||||
resetDndState(false);
|
||||
} else {
|
||||
cancel();
|
||||
resetDndState(true);
|
||||
}
|
||||
exitDndEventLoop();
|
||||
return true; // Eat all mouse events
|
||||
@ -195,7 +191,7 @@ Qt::DropAction QBasicDrag::drag(QDrag *o)
|
||||
return m_executed_drop_action;
|
||||
}
|
||||
|
||||
void QBasicDrag::resetDndState(bool /* deleteSource */)
|
||||
void QBasicDrag::restoreCursor()
|
||||
{
|
||||
if (m_restoreCursor) {
|
||||
#ifndef QT_NO_CURSOR
|
||||
@ -227,6 +223,7 @@ void QBasicDrag::endDrag()
|
||||
void QBasicDrag::cancel()
|
||||
{
|
||||
disableEventFilter();
|
||||
restoreCursor();
|
||||
m_drag_icon_window->setVisible(false);
|
||||
}
|
||||
|
||||
@ -239,6 +236,7 @@ void QBasicDrag::move(const QMouseEvent *)
|
||||
void QBasicDrag::drop(const QMouseEvent *)
|
||||
{
|
||||
disableEventFilter();
|
||||
restoreCursor();
|
||||
m_drag_icon_window->setVisible(false);
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ protected:
|
||||
private:
|
||||
void enableEventFilter();
|
||||
void disableEventFilter();
|
||||
void resetDndState(bool deleteSource);
|
||||
void restoreCursor();
|
||||
void exitDndEventLoop();
|
||||
|
||||
bool m_restoreCursor;
|
||||
|
@ -523,7 +523,6 @@ void QXcbDrag::drop(const QMouseEvent *event)
|
||||
current_proxy_target = 0;
|
||||
source_time = 0;
|
||||
// current_embedding_widget = 0;
|
||||
// #fixme resetDndState(false);
|
||||
}
|
||||
|
||||
Qt::DropAction QXcbDrag::toDropAction(xcb_atom_t a) const
|
||||
|
Loading…
Reference in New Issue
Block a user