QtGui: Don't set screen to a child window when processing screen events

Setting a screen to a child window causes a warning message. This patch
prevents the debug message by catching incorrect behavior made by QPA
earlier.

Change-Id: Idf3ac02290a18afc134f19c2b91348dc009ca4ca
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
bb10
Błażej Szczygieł 2016-01-05 00:05:21 +01:00
parent 7e28079484
commit 7409e3a42b
1 changed files with 6 additions and 4 deletions

View File

@ -2090,10 +2090,12 @@ void QGuiApplicationPrivate::processWindowStateChangedEvent(QWindowSystemInterfa
void QGuiApplicationPrivate::processWindowScreenChangedEvent(QWindowSystemInterfacePrivate::WindowScreenChangedEvent *wse)
{
if (QWindow *window = wse->window.data()) {
if (QScreen *screen = wse->screen.data())
window->d_func()->setTopLevelScreen(screen, false /* recreate */);
else // Fall back to default behavior, and try to find some appropriate screen
window->setScreen(0);
if (window->isTopLevel()) {
if (QScreen *screen = wse->screen.data())
window->d_func()->setTopLevelScreen(screen, false /* recreate */);
else // Fall back to default behavior, and try to find some appropriate screen
window->setScreen(0);
}
// we may have changed scaling, so trigger resize event if needed
if (window->handle()) {
QWindowSystemInterfacePrivate::GeometryChangeEvent gce(window, QHighDpi::fromNativePixels(window->handle()->geometry(), window), QRect());