Do not use QExposedEvent::region() in internal code
Task-number: QTBUG-104857 Pick-to: 6.4 6.3 6.2 Change-Id: I5ee41802ecc4d6291aaaa1f0efddd20027c1c1e4 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
00b46bf4f8
commit
12262adeba
@ -3989,10 +3989,7 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
|
||||
bool isMouse = false;
|
||||
switch (type) {
|
||||
case QEvent::Expose:
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
dbg << "QExposeEvent(" << static_cast<const QExposeEvent *>(e)->region() << ')';
|
||||
QT_WARNING_POP
|
||||
dbg << "QExposeEvent()";
|
||||
break;
|
||||
case QEvent::Paint:
|
||||
dbg << "QPaintEvent(" << static_cast<const QPaintEvent *>(e)->region() << ')';
|
||||
|
@ -520,6 +520,7 @@ public:
|
||||
|
||||
protected:
|
||||
QRegion m_region;
|
||||
friend class QWidgetWindow;
|
||||
};
|
||||
|
||||
class Q_GUI_EXPORT QPlatformSurfaceEvent : public QEvent
|
||||
|
@ -1002,11 +1002,8 @@ void QWidgetWindow::handleExposeEvent(QExposeEvent *event)
|
||||
m_widget->setAttribute(Qt::WA_Mapped);
|
||||
for (QWidget *p = m_widget->parentWidget(); p && !p->testAttribute(Qt::WA_Mapped); p = p->parentWidget())
|
||||
p->setAttribute(Qt::WA_Mapped);
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
if (!event->region().isNull())
|
||||
wPriv->syncBackingStore(event->region());
|
||||
QT_WARNING_POP
|
||||
if (!event->m_region.isNull())
|
||||
wPriv->syncBackingStore(event->m_region);
|
||||
} else {
|
||||
m_widget->setAttribute(Qt::WA_Mapped, false);
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ public:
|
||||
backingStore.resize(size());
|
||||
}
|
||||
|
||||
void exposeEvent(QExposeEvent *event) override
|
||||
void paintEvent(QPaintEvent *event) override
|
||||
{
|
||||
QRect rect(QPoint(), size());
|
||||
|
||||
@ -251,10 +251,7 @@ public:
|
||||
|
||||
backingStore.endPaint();
|
||||
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
backingStore.flush(event->region().boundingRect());
|
||||
QT_WARNING_POP
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -287,13 +287,6 @@ public:
|
||||
m_received[event->type()]++;
|
||||
m_order << 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:
|
||||
m_surfaceventType = static_cast<QPlatformSurfaceEvent *>(event)->surfaceEventType();
|
||||
break;
|
||||
@ -323,11 +316,6 @@ QT_WARNING_POP
|
||||
return m_order.indexOf(type);
|
||||
}
|
||||
|
||||
QRegion exposeRegion() const
|
||||
{
|
||||
return m_exposeRegion;
|
||||
}
|
||||
|
||||
QPlatformSurfaceEvent::SurfaceEventType surfaceEventType() const
|
||||
{
|
||||
return m_surfaceventType;
|
||||
@ -339,7 +327,6 @@ QT_WARNING_POP
|
||||
private:
|
||||
QHash<QEvent::Type, int> m_received;
|
||||
QList<QEvent::Type> m_order;
|
||||
QRegion m_exposeRegion;
|
||||
QPlatformSurfaceEvent::SurfaceEventType m_surfaceventType;
|
||||
};
|
||||
|
||||
@ -797,16 +784,6 @@ void tst_QWindow::isExposed()
|
||||
QTRY_VERIFY(window.received(QEvent::Expose) > 0);
|
||||
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();
|
||||
|
||||
QCoreApplication::processEvents();
|
||||
|
Loading…
Reference in New Issue
Block a user