diff options
Diffstat (limited to 'src/gui/kernel/qsimpledrag.cpp')
-rw-r--r-- | src/gui/kernel/qsimpledrag.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp index a88955b99a..77cbfd2b96 100644 --- a/src/gui/kernel/qsimpledrag.cpp +++ b/src/gui/kernel/qsimpledrag.cpp @@ -35,7 +35,7 @@ Q_LOGGING_CATEGORY(lcDnd, "qt.gui.dnd") static QWindow* topLevelAt(const QPoint &pos) { QWindowList list = QGuiApplication::topLevelWindows(); - for (int i = list.count()-1; i >= 0; --i) { + for (int i = list.size()-1; i >= 0; --i) { QWindow *w = list.at(i); if (w->isVisible() && w->handle() && w->geometry().contains(pos) && !qobject_cast<QShapedPixmapWindow*>(w)) return w; @@ -124,6 +124,7 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e) } case QEvent::MouseButtonRelease: { + QPointer<QObject> objGuard(o); disableEventFilter(); if (canDrop()) { QPoint nativePosition = getNativeMousePos(e, m_drag_icon_window); @@ -133,6 +134,8 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e) cancel(); } exitDndEventLoop(); + if (!objGuard) + return true; // If a QShapedPixmapWindow (drag feedback) is being dragged along, the // mouse event's localPos() will be relative to that, which is useless. @@ -306,7 +309,7 @@ static inline QPoint fromNativeGlobalPixels(const QPoint &point) #ifndef QT_NO_HIGHDPISCALING QPoint res = point; if (QHighDpiScaling::isActive()) { - for (const QScreen *s : qAsConst(QGuiApplicationPrivate::screen_list)) { + for (const QScreen *s : std::as_const(QGuiApplicationPrivate::screen_list)) { if (s->handle()->geometry().contains(point)) { res = QHighDpi::fromNativePixels(point, s); break; |