diff options
Diffstat (limited to 'src/gui/kernel/qplatformscreen.cpp')
-rw-r--r-- | src/gui/kernel/qplatformscreen.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/gui/kernel/qplatformscreen.cpp b/src/gui/kernel/qplatformscreen.cpp index 9e038b4032..0369a0b12a 100644 --- a/src/gui/kernel/qplatformscreen.cpp +++ b/src/gui/kernel/qplatformscreen.cpp @@ -25,10 +25,8 @@ QPlatformScreen::QPlatformScreen() QPlatformScreen::~QPlatformScreen() { Q_D(QPlatformScreen); - if (d->screen) { - qWarning("Manually deleting a QPlatformScreen. Call QWindowSystemInterface::handleScreenRemoved instead."); - delete d->screen; - } + Q_ASSERT_X(!d->screen, "QPlatformScreen", + "QPlatformScreens should be removed via QWindowSystemInterface::handleScreenRemoved()"); } /*! @@ -56,8 +54,9 @@ QPixmap QPlatformScreen::grabWindow(WId window, int x, int y, int width, int hei QWindow *QPlatformScreen::topLevelAt(const QPoint & pos) const { const QWindowList list = QGuiApplication::topLevelWindows(); - for (int i = list.size()-1; i >= 0; --i) { - QWindow *w = list[i]; + const auto crend = list.crend(); + for (auto it = list.crbegin(); it != crend; ++it) { + QWindow *w = *it; if (w->isVisible() && QHighDpi::toNativePixels(w->geometry(), w).contains(pos)) return w; } |