Don't rely on QRasterWindow::resizeEvent for marking window dirty
The de-virtualization gotcha might result in client code not calling QRasterWindow::resizeEvent, which we use for dirty state management after e0eb2818face4ffb7dafd87464f355d4654b7be0. In practice this wasn't an issue, because QPaintDeviceWindow handles paint events by calling markWindowAsDirty first, but we should not rely on this. Instead plumb the resize event to QPaintDeviceWindowPrivate, which QRasterWindow implements and can override the behavior of. Pick-to: 6.6 6.5 Change-Id: I5c0747da10f0275b77f56be32690d796fa48cdb4 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 6cb497c1570ee427460962b2c0abe3b6dd8c4ae6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
3e563542b3
commit
527b5f6ff4
@ -171,6 +171,8 @@ bool QPaintDeviceWindow::event(QEvent *event)
|
||||
auto region = QRect(QPoint(0, 0), size());
|
||||
d->doFlush(region); // Will end up calling paintEvent
|
||||
return true;
|
||||
} else if (event->type() == QEvent::Resize) {
|
||||
d->handleResizeEvent();
|
||||
}
|
||||
|
||||
return QWindow::event(event);
|
||||
|
@ -31,6 +31,8 @@ public:
|
||||
QPaintDeviceWindowPrivate();
|
||||
~QPaintDeviceWindowPrivate() override;
|
||||
|
||||
virtual void handleResizeEvent() {}
|
||||
|
||||
virtual void beginPaint(const QRegion ®ion)
|
||||
{
|
||||
Q_UNUSED(region);
|
||||
|
@ -34,6 +34,13 @@ class QRasterWindowPrivate : public QPaintDeviceWindowPrivate
|
||||
{
|
||||
Q_DECLARE_PUBLIC(QRasterWindow)
|
||||
public:
|
||||
void handleResizeEvent() override
|
||||
{
|
||||
Q_Q(QRasterWindow);
|
||||
if (backingstore->size() != q->size())
|
||||
markWindowAsDirty();
|
||||
}
|
||||
|
||||
void beginPaint(const QRegion ®ion) override
|
||||
{
|
||||
Q_Q(QRasterWindow);
|
||||
@ -103,9 +110,6 @@ QPaintDevice *QRasterWindow::redirected(QPoint *) const
|
||||
|
||||
void QRasterWindow::resizeEvent(QResizeEvent *)
|
||||
{
|
||||
Q_D(QRasterWindow);
|
||||
if (d->backingstore->size() != size())
|
||||
d->markWindowAsDirty();
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
Loading…
x
Reference in New Issue
Block a user