//screen list is populated.
Q_ASSERT(d->screen);
+ connect(d->screen, SIGNAL(destroyed(QObject *)), this, SLOT(screenDestroyed(QObject *)));
QGuiApplicationPrivate::window_list.prepend(this);
}
const bool wasCreated = d->platformWindow != 0;
if (wasCreated)
destroy();
+ if (d->screen)
+ disconnect(d->screen, SIGNAL(destroyed(QObject *)), this, SLOT(screenDestroyed(QObject *)));
d->screen = newScreen;
- if (wasCreated)
- create();
+ if (newScreen) {
+ connect(d->screen, SIGNAL(destroyed(QObject *)), this, SLOT(screenDestroyed(QObject *)));
+ if (wasCreated)
+ create();
+ }
+ emit screenChanged(newScreen);
}
}
+void QWindow::screenDestroyed(QObject *object)
+{
+ Q_D(QWindow);
+ if (object == static_cast<QObject *>(d->screen))
+ setScreen(0);
+}
+
+/*!
+ \fn QWindow::screenChanged(QScreen *screen)
+
+ This signal is emitted when a window's screen changes, either
+ by being set explicitly with setScreen(), or automatically when
+ the window's screen is removed.
+*/
+
/*!
Returns the accessibility interface for the object that the window represents
\preliminary
Q_SIGNALS:
void backBufferReady();
+ void screenChanged(QScreen *screen);
void xChanged(int arg);
void orientationChanged(Qt::ScreenOrientation arg);
+private Q_SLOTS:
+ void screenDestroyed(QObject *screen);
+
protected:
virtual void exposeEvent(QExposeEvent *);
virtual void resizeEvent(QResizeEvent *);