Don't drop update requests when closing and reopening windows
Before commit 4d15f393a76cfcc4d54f311884fedac5bf0f72ee update requests were handled by a timer on QWindow. Therefore they survived the closing and re-opening of platform windows. Now, as the timer was moved to QPlatformWindow, it gets reset when you close the QWindow, and any pending update requests are lost. However, we do set the updateRequestPending variable on QWindow when requesting an update. Therefore, we can also restore the update timer on the platform window when creating it. Change-Id: I23b00f24a46706beac7d1455edd8a5623db46b22 Fixes: QTBUG-70957 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
parent
00ae1e6b7b
commit
402efef57b
@ -546,6 +546,9 @@ void QWindowPrivate::create(bool recursive, WId nativeHandle)
|
||||
|
||||
QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceCreated);
|
||||
QGuiApplication::sendEvent(q, &e);
|
||||
|
||||
if (updateRequestPending)
|
||||
platformWindow->requestUpdate();
|
||||
}
|
||||
|
||||
void QWindowPrivate::clearFocusObject()
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <qrasterwindow.h>
|
||||
#include <qpa/qwindowsysteminterface.h>
|
||||
#include <qpa/qplatformintegration.h>
|
||||
#include <qpa/qplatformwindow.h>
|
||||
#include <private/qguiapplication_p.h>
|
||||
#include <private/qhighdpiscaling_p.h>
|
||||
#include <QtGui/QPainter>
|
||||
@ -114,6 +115,7 @@ private slots:
|
||||
void cleanup();
|
||||
void testBlockingWindowShownAfterModalDialog();
|
||||
void generatedMouseMove();
|
||||
void keepPendingUpdateRequests();
|
||||
|
||||
private:
|
||||
QPoint m_availableTopLeft;
|
||||
@ -2451,6 +2453,27 @@ void tst_QWindow::generatedMouseMove()
|
||||
QVERIFY(w.mouseMovedCount == 5);
|
||||
}
|
||||
|
||||
void tst_QWindow::keepPendingUpdateRequests()
|
||||
{
|
||||
QRect geometry(m_availableTopLeft + QPoint(80, 80), m_testWindowSize);
|
||||
|
||||
Window window;
|
||||
window.setGeometry(geometry);
|
||||
window.show();
|
||||
QCoreApplication::processEvents();
|
||||
QTRY_VERIFY(window.isExposed());
|
||||
|
||||
window.requestUpdate();
|
||||
window.close();
|
||||
window.setVisible(true);
|
||||
|
||||
QPlatformWindow *platformWindow = window.handle();
|
||||
QVERIFY(platformWindow);
|
||||
|
||||
QVERIFY(platformWindow->hasPendingUpdateRequest());
|
||||
QTRY_VERIFY(!platformWindow->hasPendingUpdateRequest());
|
||||
}
|
||||
|
||||
#include <tst_qwindow.moc>
|
||||
QTEST_MAIN(tst_QWindow)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user