summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/kernel/qcoreevent.h5
-rw-r--r--src/testlib/qtestspontaneevent.h11
2 files changed, 7 insertions, 9 deletions
diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h
index 53da4a849b..9aa3a2d290 100644
--- a/src/corelib/kernel/qcoreevent.h
+++ b/src/corelib/kernel/qcoreevent.h
@@ -317,6 +317,11 @@ private:
friend class QGraphicsView;
friend class QGraphicsScene;
friend class QGraphicsScenePrivate;
+ // from QtTest:
+ friend class QSpontaneKeyEvent;
+ // needs this:
+ Q_ALWAYS_INLINE
+ void setSpontaneous() { spont = true; }
};
class Q_CORE_EXPORT QTimerEvent : public QEvent
diff --git a/src/testlib/qtestspontaneevent.h b/src/testlib/qtestspontaneevent.h
index 18c4221f72..bc775aa803 100644
--- a/src/testlib/qtestspontaneevent.h
+++ b/src/testlib/qtestspontaneevent.h
@@ -76,17 +76,10 @@ public:
}
#endif
+ // ### Qt 6: remove everything except this function:
static inline void setSpontaneous(QEvent *ev)
{
- // use a union instead of a reinterpret_cast to prevent alignment warnings
- union
- {
- QSpontaneKeyEvent *skePtr;
- QEvent *evPtr;
- } helper;
-
- helper.evPtr = ev;
- helper.skePtr->setSpontaneous();
+ ev->setSpontaneous();
}
protected: