From ba976799293606b2ae0bc9082f76157952544d96 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Fri, 3 Jan 2020 16:41:23 +0000 Subject: [PATCH] sync QSpontaneKeyEvent with QEvent and fix size check Signed-off-by: Ivailo Monev --- src/test/qtestspontaneevent.h | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/src/test/qtestspontaneevent.h b/src/test/qtestspontaneevent.h index 2f72091e0..45236e607 100644 --- a/src/test/qtestspontaneevent.h +++ b/src/test/qtestspontaneevent.h @@ -40,44 +40,22 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -#ifndef QTEST_NO_SIZEOF_CHECK -template -class QEventSizeOfChecker -{ -private: - QEventSizeOfChecker() {} -}; - -template <> -class QEventSizeOfChecker -{ -public: - QEventSizeOfChecker() {} -}; -#endif - class QSpontaneKeyEvent { public: void setSpontaneous() { spont = 1; } bool spontaneous() { return spont; } - virtual void dummyFunc() {} virtual ~QSpontaneKeyEvent() {} -#ifndef QTEST_NO_SIZEOF_CHECK - inline void ifYouGetCompileErrorHereYouUseWrongQt() + static inline void setSpontaneous(QEvent *ev) { - // this is a static assert in case QEvent changed in Qt - QEventSizeOfChecker dummy; + Q_ASSERT(sizeof(QSpontaneKeyEvent) == sizeof(QEvent)); // Fixing the warnings about unused variables Q_UNUSED(posted); Q_UNUSED(m_accept); - } -#endif + Q_UNUSED(looplevel); - static inline void setSpontaneous(QEvent *ev) - { // use a union instead of a reinterpret_cast to prevent alignment warnings union { @@ -90,13 +68,13 @@ public: } protected: - void *d; QEvent::Type t; private: bool posted; bool spont; bool m_accept; + int looplevel; }; QT_END_NAMESPACE