diff options
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 14 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qscreen.cpp | 10 | ||||
-rw-r--r-- | src/gui/kernel/qscreen.h | 1 |
4 files changed, 25 insertions, 1 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 87c95e6420..96bea942ea 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -897,7 +897,19 @@ QList<QScreen *> QGuiApplication::screens() This signal is emitted whenever a new screen \a screen has been added to the system. - \sa screens(), primaryScreen() + \sa screens(), primaryScreen(), screenRemoved() +*/ + +/*! + \fn void QGuiApplication::screenRemoved(QScreen *screen) + + This signal is emitted whenever a \a screen is removed from the system. It + provides an opportunity to manage the windows on the screen before Qt falls back + to moving them to the primary screen. + + \sa screens(), screenAdded(), QObject::destroyed(), QWindow::setScreen() + + \since 5.4 */ diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h index 1b1e1dabff..6e751e1275 100644 --- a/src/gui/kernel/qguiapplication.h +++ b/src/gui/kernel/qguiapplication.h @@ -165,6 +165,7 @@ public: Q_SIGNALS: void fontDatabaseChanged(); void screenAdded(QScreen *screen); + void screenRemoved(QScreen *screen); void lastWindowClosed(); void focusObjectChanged(QObject *focusObject); void focusWindowChanged(QWindow *focusWindow); diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp index 70ee631fc8..90f48d4593 100644 --- a/src/gui/kernel/qscreen.cpp +++ b/src/gui/kernel/qscreen.cpp @@ -74,6 +74,16 @@ QScreen::QScreen(QPlatformScreen *screen) { } + +/*! + Destroys the screen. + */ +QScreen::~QScreen() +{ + if (qApp) + Q_EMIT qApp->screenRemoved(this); +} + /*! Get the platform screen handle. */ diff --git a/src/gui/kernel/qscreen.h b/src/gui/kernel/qscreen.h index bdd5939657..9e439f5a20 100644 --- a/src/gui/kernel/qscreen.h +++ b/src/gui/kernel/qscreen.h @@ -89,6 +89,7 @@ class Q_GUI_EXPORT QScreen : public QObject Q_PROPERTY(qreal refreshRate READ refreshRate NOTIFY refreshRateChanged) public: + ~QScreen(); QPlatformScreen *handle() const; QString name() const; |