QWindowWindow: Avoid resize events from the ctor
When calling showFullScreen(), the setwindowStates call in the QWindowsWindow constructor led to generating a resize event. This is pretty bad for example when QOpenGLWindow is involved since the QWindow's platformWindow member is not even set yet (handle() == nullptr) so everything related to OpenGL contexts starts failing (as there is no underlying platform window yet as far as the QWindow is concerned). In short, generating geometry changes from the platformwindow ctor is a bad idea. Use initialize() instead for that. Task-number: QTBUG-67027 Change-Id: I35d11949213eb21f81b2ff2d4f2282cb36510210 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
aaace8fbdb
commit
a060ee2802
@ -222,6 +222,9 @@ void QOpenGLWindowPrivate::initialize()
|
||||
if (context)
|
||||
return;
|
||||
|
||||
if (!q->handle())
|
||||
qWarning("Attempted to initialize QOpenGLWindow without a platform window");
|
||||
|
||||
context.reset(new QOpenGLContext);
|
||||
context->setShareContext(shareContext);
|
||||
context->setFormat(q->requestedFormat());
|
||||
|
@ -1107,7 +1107,6 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data)
|
||||
updateDropSite(window()->isTopLevel());
|
||||
|
||||
registerTouchWindow();
|
||||
setWindowState(aWindow->windowStates());
|
||||
const qreal opacity = qt_window_private(aWindow)->opacity;
|
||||
if (!qFuzzyCompare(opacity, qreal(1.0)))
|
||||
setOpacity(opacity);
|
||||
@ -1136,9 +1135,11 @@ void QWindowsWindow::initialize()
|
||||
QWindowCreationContextPtr creationContext =
|
||||
QWindowsContext::instance()->setWindowCreationContext(QWindowCreationContextPtr());
|
||||
|
||||
QWindow *w = window();
|
||||
setWindowState(w->windowStates());
|
||||
|
||||
// Trigger geometry change (unless it has a special state in which case setWindowState()
|
||||
// will send the message) and screen change signals of QWindow.
|
||||
QWindow *w = window();
|
||||
if (w->type() != Qt::Desktop) {
|
||||
const Qt::WindowState state = w->windowState();
|
||||
if (state != Qt::WindowMaximized && state != Qt::WindowFullScreen
|
||||
|
Loading…
x
Reference in New Issue
Block a user