Do not use QExposedEvent::region() in internal code
Task-number: QTBUG-104857 Change-Id: I5ee41802ecc4d6291aaaa1f0efddd20027c1c1e4 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 12262adebad5e4af2cf2c9a6dd41a941c78f1988) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
d84ee92ecf
commit
9693867fed
@ -3989,10 +3989,7 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
|
|||||||
bool isMouse = false;
|
bool isMouse = false;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case QEvent::Expose:
|
case QEvent::Expose:
|
||||||
QT_WARNING_PUSH
|
dbg << "QExposeEvent()";
|
||||||
QT_WARNING_DISABLE_DEPRECATED
|
|
||||||
dbg << "QExposeEvent(" << static_cast<const QExposeEvent *>(e)->region() << ')';
|
|
||||||
QT_WARNING_POP
|
|
||||||
break;
|
break;
|
||||||
case QEvent::Paint:
|
case QEvent::Paint:
|
||||||
dbg << "QPaintEvent(" << static_cast<const QPaintEvent *>(e)->region() << ')';
|
dbg << "QPaintEvent(" << static_cast<const QPaintEvent *>(e)->region() << ')';
|
||||||
|
@ -516,6 +516,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
QRegion m_region;
|
QRegion m_region;
|
||||||
|
friend class QWidgetWindow;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Q_GUI_EXPORT QPlatformSurfaceEvent : public QEvent
|
class Q_GUI_EXPORT QPlatformSurfaceEvent : public QEvent
|
||||||
|
@ -1002,11 +1002,8 @@ void QWidgetWindow::handleExposeEvent(QExposeEvent *event)
|
|||||||
m_widget->setAttribute(Qt::WA_Mapped);
|
m_widget->setAttribute(Qt::WA_Mapped);
|
||||||
for (QWidget *p = m_widget->parentWidget(); p && !p->testAttribute(Qt::WA_Mapped); p = p->parentWidget())
|
for (QWidget *p = m_widget->parentWidget(); p && !p->testAttribute(Qt::WA_Mapped); p = p->parentWidget())
|
||||||
p->setAttribute(Qt::WA_Mapped);
|
p->setAttribute(Qt::WA_Mapped);
|
||||||
QT_WARNING_PUSH
|
if (!event->m_region.isNull())
|
||||||
QT_WARNING_DISABLE_DEPRECATED
|
wPriv->syncBackingStore(event->m_region);
|
||||||
if (!event->region().isNull())
|
|
||||||
wPriv->syncBackingStore(event->region());
|
|
||||||
QT_WARNING_POP
|
|
||||||
} else {
|
} else {
|
||||||
m_widget->setAttribute(Qt::WA_Mapped, false);
|
m_widget->setAttribute(Qt::WA_Mapped, false);
|
||||||
}
|
}
|
||||||
|
@ -239,7 +239,7 @@ public:
|
|||||||
backingStore.resize(size());
|
backingStore.resize(size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void exposeEvent(QExposeEvent *event) override
|
void paintEvent(QPaintEvent *event) override
|
||||||
{
|
{
|
||||||
QRect rect(QPoint(), size());
|
QRect rect(QPoint(), size());
|
||||||
|
|
||||||
@ -251,10 +251,7 @@ public:
|
|||||||
|
|
||||||
backingStore.endPaint();
|
backingStore.endPaint();
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
|
||||||
QT_WARNING_DISABLE_DEPRECATED
|
|
||||||
backingStore.flush(event->region().boundingRect());
|
backingStore.flush(event->region().boundingRect());
|
||||||
QT_WARNING_POP
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -287,13 +287,6 @@ public:
|
|||||||
m_received[event->type()]++;
|
m_received[event->type()]++;
|
||||||
m_order << event->type();
|
m_order << event->type();
|
||||||
switch (event->type()) {
|
switch (event->type()) {
|
||||||
case QEvent::Expose:
|
|
||||||
QT_WARNING_PUSH
|
|
||||||
QT_WARNING_DISABLE_DEPRECATED
|
|
||||||
m_exposeRegion = static_cast<QExposeEvent *>(event)->region();
|
|
||||||
QT_WARNING_POP
|
|
||||||
break;
|
|
||||||
|
|
||||||
case QEvent::PlatformSurface:
|
case QEvent::PlatformSurface:
|
||||||
m_surfaceventType = static_cast<QPlatformSurfaceEvent *>(event)->surfaceEventType();
|
m_surfaceventType = static_cast<QPlatformSurfaceEvent *>(event)->surfaceEventType();
|
||||||
break;
|
break;
|
||||||
@ -323,11 +316,6 @@ QT_WARNING_POP
|
|||||||
return m_order.indexOf(type);
|
return m_order.indexOf(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
QRegion exposeRegion() const
|
|
||||||
{
|
|
||||||
return m_exposeRegion;
|
|
||||||
}
|
|
||||||
|
|
||||||
QPlatformSurfaceEvent::SurfaceEventType surfaceEventType() const
|
QPlatformSurfaceEvent::SurfaceEventType surfaceEventType() const
|
||||||
{
|
{
|
||||||
return m_surfaceventType;
|
return m_surfaceventType;
|
||||||
@ -339,7 +327,6 @@ QT_WARNING_POP
|
|||||||
private:
|
private:
|
||||||
QHash<QEvent::Type, int> m_received;
|
QHash<QEvent::Type, int> m_received;
|
||||||
QList<QEvent::Type> m_order;
|
QList<QEvent::Type> m_order;
|
||||||
QRegion m_exposeRegion;
|
|
||||||
QPlatformSurfaceEvent::SurfaceEventType m_surfaceventType;
|
QPlatformSurfaceEvent::SurfaceEventType m_surfaceventType;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -797,16 +784,6 @@ void tst_QWindow::isExposed()
|
|||||||
QTRY_VERIFY(window.received(QEvent::Expose) > 0);
|
QTRY_VERIFY(window.received(QEvent::Expose) > 0);
|
||||||
QTRY_VERIFY(window.isExposed());
|
QTRY_VERIFY(window.isExposed());
|
||||||
|
|
||||||
#ifndef Q_OS_WIN
|
|
||||||
// This is a top-level window so assuming it is completely exposed, the
|
|
||||||
// expose region must be (0, 0), (width, height). If this is not the case,
|
|
||||||
// the platform plugin is sending expose events with a region in an
|
|
||||||
// incorrect coordinate system.
|
|
||||||
QRect r = window.exposeRegion().boundingRect();
|
|
||||||
r = QRect(window.mapToGlobal(r.topLeft()), r.size());
|
|
||||||
QCOMPARE(r, window.geometry());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
window.hide();
|
window.hide();
|
||||||
|
|
||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user