mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 19:02:59 +00:00
sync QSpontaneKeyEvent with QEvent and fix size check
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
7cc04feeac
commit
ba97679929
1 changed files with 4 additions and 26 deletions
|
@ -40,44 +40,22 @@ QT_BEGIN_HEADER
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef QTEST_NO_SIZEOF_CHECK
|
||||
template <int>
|
||||
class QEventSizeOfChecker
|
||||
{
|
||||
private:
|
||||
QEventSizeOfChecker() {}
|
||||
};
|
||||
|
||||
template <>
|
||||
class QEventSizeOfChecker<sizeof(QEvent)>
|
||||
{
|
||||
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<sizeof(QSpontaneKeyEvent)> 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
|
||||
|
|
Loading…
Add table
Reference in a new issue