summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <[email protected]>2024-12-04 14:16:59 -0800
committerThiago Macieira <[email protected]>2024-12-13 07:53:10 -0800
commit438b2f2d604133349777c670590b27a82832e290 (patch)
tree810b879229e2d255df52e52fafad4cf83937d26d
parent902058e750e67bbfb166db576c538b7add9be08f (diff)
Q*Application: move the compressEvent() virtual to the Private class
One of the parameters is the QPostEventList, which is declared in qthread_p.h: class QPostEventList : public QList<QPostEvent> and is thus private API anyway. This also requires the ELFVERSION: token in qthread_p.h to avoid marking every class derived from Q*Application as needing private Qt ABI. We can't remove the virtual in Qt 6, so we keep the fallback implementations to just forward to the Private::compressEvent() call. I've elected to mark the QApplication's override as final. Change-Id: I49a46f42e62bcaf7db69fffd12a664d8720bbe46 Reviewed-by: Ivan Solovev <[email protected]> Reviewed-by: Thiago Macieira <[email protected]>
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp7
-rw-r--r--src/corelib/kernel/qcoreapplication.h4
-rw-r--r--src/corelib/kernel/qcoreapplication_p.h1
-rw-r--r--src/corelib/thread/qthread_p.h1
-rw-r--r--src/gui/kernel/qevent.h2
-rw-r--r--src/gui/kernel/qguiapplication.cpp2
-rw-r--r--src/gui/kernel/qguiapplication.h2
-rw-r--r--src/widgets/kernel/qapplication.cpp9
-rw-r--r--src/widgets/kernel/qapplication.h2
-rw-r--r--src/widgets/kernel/qapplication_p.h1
-rw-r--r--src/widgets/kernel/qwidget_p.h1
11 files changed, 31 insertions, 1 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 2094e12dc32..7f10c8eb35a 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -1686,8 +1686,15 @@ void QCoreApplication::postEvent(QObject *receiver, QEvent *event, int priority)
\internal
Returns \c true if \a event was compressed away (possibly deleted) and should not be added to the list.
*/
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
bool QCoreApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventList *postedEvents)
{
+ return d_func()->compressEvent(event, receiver, postedEvents);
+}
+#endif
+
+bool QCoreApplicationPrivate::compressEvent(QEvent *event, QObject *receiver, QPostEventList *postedEvents)
+{
Q_ASSERT(event);
Q_ASSERT(receiver);
Q_ASSERT(postedEvents);
diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h
index 421578117cd..2ce79790404 100644
--- a/src/corelib/kernel/qcoreapplication.h
+++ b/src/corelib/kernel/qcoreapplication.h
@@ -30,7 +30,9 @@ QT_BEGIN_NAMESPACE
class QCoreApplicationPrivate;
class QTranslator;
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
class QPostEventList;
+#endif
class QAbstractEventDispatcher;
class QAbstractNativeEventFilter;
class QEventLoopLocker;
@@ -211,7 +213,9 @@ Q_SIGNALS:
protected:
bool event(QEvent *) override;
+# if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
virtual bool compressEvent(QEvent *, QObject *receiver, QPostEventList *);
+# endif
#endif // QT_NO_QOBJECT
protected:
diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h
index 48783626bdc..a1e0e4d560a 100644
--- a/src/corelib/kernel/qcoreapplication_p.h
+++ b/src/corelib/kernel/qcoreapplication_p.h
@@ -98,6 +98,7 @@ public:
virtual void createEventDispatcher();
virtual void eventDispatcherReady();
+ virtual bool compressEvent(QEvent *event, QObject *receiver, QPostEventList *postedEvents);
static void removePostedEvent(QEvent *);
#ifdef Q_OS_WIN
static void removePostedTimerEvent(QObject *object, int timerId);
diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h
index 5f64293e467..eb721509776 100644
--- a/src/corelib/thread/qthread_p.h
+++ b/src/corelib/thread/qthread_p.h
@@ -58,6 +58,7 @@ inline bool operator<(const QPostEvent &first, const QPostEvent &second)
// This class holds the list of posted events.
// The list has to be kept sorted by priority
+// ### Qt7 remove the next line
// It's used in a virtual in QCoreApplication, so ELFVERSION:ignore-next
class QPostEventList : public QList<QPostEvent>
{
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 82c309b8d0a..2374e527e3e 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -510,6 +510,7 @@ public:
protected:
QPoint m_pos, m_oldPos;
friend class QApplication;
+ friend class QApplicationPrivate;
};
class Q_GUI_EXPORT QExposeEvent : public QEvent
@@ -556,6 +557,7 @@ public:
protected:
QSize m_size, m_oldSize;
friend class QApplication;
+ friend class QApplicationPrivate;
};
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 1e44ac83361..dcdff702c44 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -2120,6 +2120,7 @@ bool QGuiApplication::event(QEvent *e)
return QCoreApplication::event(e);
}
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
/*!
\internal
*/
@@ -2127,6 +2128,7 @@ bool QGuiApplication::compressEvent(QEvent *event, QObject *receiver, QPostEvent
{
return QCoreApplication::compressEvent(event, receiver, postedEvents);
}
+#endif
bool QGuiApplicationPrivate::sendQWindowEventToQPlatformWindow(QWindow *window, QEvent *event)
{
diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h
index 23d7fb3d652..0af6489428e 100644
--- a/src/gui/kernel/qguiapplication.h
+++ b/src/gui/kernel/qguiapplication.h
@@ -163,7 +163,9 @@ Q_SIGNALS:
#endif
protected:
bool event(QEvent *) override;
+# if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
bool compressEvent(QEvent *, QObject *receiver, QPostEventList *) override;
+# endif
QGuiApplication(QGuiApplicationPrivate &p);
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 297c3f45ac9..37be88927e6 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -782,8 +782,15 @@ QWidget *QApplication::widgetAt(const QPoint &p)
/*!
\internal
*/
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventList *postedEvents)
{
+ return d_func()->compressEvent(event, receiver, postedEvents);
+}
+#endif
+
+bool QApplicationPrivate::compressEvent(QEvent *event, QObject *receiver, QPostEventList *postedEvents)
+{
// Only compress the following events:
const QEvent::Type type = event->type();
switch (type) {
@@ -795,7 +802,7 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis
case QEvent::LanguageChange:
break;
default:
- return QGuiApplication::compressEvent(event, receiver, postedEvents);
+ return QGuiApplicationPrivate::compressEvent(event, receiver, postedEvents);
}
for (const auto &postedEvent : std::as_const(*postedEvents)) {
diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h
index fd698fb69f0..c54aff4a233 100644
--- a/src/widgets/kernel/qapplication.h
+++ b/src/widgets/kernel/qapplication.h
@@ -140,7 +140,9 @@ public Q_SLOTS:
protected:
bool event(QEvent *) override;
+# if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
bool compressEvent(QEvent *, QObject *receiver, QPostEventList *) override;
+# endif
private:
Q_DISABLE_COPY(QApplication)
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index 622d36135cd..3e7c5edab45 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -75,6 +75,7 @@ public:
static void dispatchEnterLeave(QWidget *enter, QWidget *leave, const QPointF &globalPosF);
static QWidget *desktop();
void notifyWindowIconChanged() override;
+ bool compressEvent(QEvent *event, QObject *receiver, QPostEventList *postedEvents) final;
#ifndef QT_NO_ACTION
QActionPrivate *createActionPrivate() const override;
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index 0c25b6d8237..fd920c3971e 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -83,6 +83,7 @@ public:
protected:
friend class QApplication;
+ friend class QApplicationPrivate;
QRegion m_region;
};