diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 9f8186424e..625b466233 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1487,7 +1487,7 @@ bool QGuiApplicationPrivate::shouldQuit() QWindowList list = QGuiApplication::topLevelWindows(); for (int i = 0; i < list.size(); ++i) { QWindow *w = list.at(i); - if (w->visible()) + if (w->isVisible()) return false; } return true; diff --git a/src/gui/kernel/qplatformscreen_qpa.cpp b/src/gui/kernel/qplatformscreen_qpa.cpp index b8f1430d1b..c832d853f4 100644 --- a/src/gui/kernel/qplatformscreen_qpa.cpp +++ b/src/gui/kernel/qplatformscreen_qpa.cpp @@ -93,7 +93,7 @@ QWindow *QPlatformScreen::topLevelAt(const QPoint & pos) const QWindowList list = QGuiApplication::topLevelWindows(); for (int i = list.size()-1; i >= 0; --i) { QWindow *w = list[i]; - if (w->visible() && w->geometry().contains(pos)) + if (w->isVisible() && w->geometry().contains(pos)) return w; } diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index d15198c505..96fb394643 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -185,7 +185,13 @@ void QWindow::setVisible(bool visible) } } + bool QWindow::visible() const +{ + return isVisible(); +} + +bool QWindow::isVisible() const { Q_D(const QWindow); @@ -965,7 +971,7 @@ bool QWindow::event(QEvent *ev) case QEvent::Close: { Q_D(QWindow); - bool wasVisible = visible(); + bool wasVisible = isVisible(); destroy(); if (wasVisible) d->maybeQuitOnLastWindowClosed(); @@ -1099,7 +1105,7 @@ void QWindowPrivate::maybeQuitOnLastWindowClosed() bool lastWindowClosed = true; for (int i = 0; i < list.size(); ++i) { QWindow *w = list.at(i); - if (!w->visible()) + if (!w->isVisible()) continue; lastWindowClosed = false; break; diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index 98b468b142..061426befb 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -89,7 +89,7 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface Q_PROPERTY(int y READ y WRITE setY NOTIFY yChanged) Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged) Q_PROPERTY(int height READ height WRITE setHeight NOTIFY heightChanged) - Q_PROPERTY(bool visible READ visible WRITE setVisible NOTIFY visibleChanged) + Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) Q_PROPERTY(Qt::ScreenOrientation contentOrientation READ contentOrientation WRITE reportContentOrientationChange NOTIFY contentOrientationChanged) public: @@ -101,7 +101,9 @@ public: void setSurfaceType(SurfaceType surfaceType); SurfaceType surfaceType() const; - bool visible() const; + QT_DEPRECATED bool visible() const; + + bool isVisible() const; void create();