From 587c004ce82844980c679547f86109174cbe6202 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 28 Sep 2009 13:13:47 +0200 Subject: Make QSignalEvent and QWrappedEvent inner classes of QStateMachine Those two classes are specific to the state machine framework, but their names were so generic that we felt they were polluting the Q-namespace. They are now QStateMachine::SignalEvent and QStateMachine::WrappedEvent. Reviewed-by: Eskil Abrahamsen Blomfeldt --- demos/sub-attaq/states.cpp | 5 +- doc/src/examples/rogue.qdoc | 2 +- doc/src/frameworks-technologies/statemachine.qdoc | 6 +- doc/src/snippets/statemachine/eventtest.cpp | 2 +- examples/animation/stickman/lifecycle.cpp | 2 +- examples/statemachine/factorial/main.cpp | 6 +- examples/statemachine/rogue/movementtransition.h | 6 +- src/corelib/kernel/qcoreevent.cpp | 4 +- src/corelib/statemachine/qeventtransition.cpp | 12 ++-- src/corelib/statemachine/qsignalevent.h | 83 ----------------------- src/corelib/statemachine/qsignaltransition.cpp | 15 ++-- src/corelib/statemachine/qstatemachine.cpp | 49 +++++++------ src/corelib/statemachine/qstatemachine.h | 36 +++++++++- src/corelib/statemachine/qwrappedevent.h | 80 ---------------------- src/corelib/statemachine/statemachine.pri | 4 +- src/gui/statemachine/qkeyeventtransition.cpp | 4 +- src/gui/statemachine/qmouseeventtransition.cpp | 4 +- tests/auto/qstatemachine/tst_qstatemachine.cpp | 4 +- 18 files changed, 94 insertions(+), 230 deletions(-) delete mode 100644 src/corelib/statemachine/qsignalevent.h delete mode 100644 src/corelib/statemachine/qwrappedevent.h diff --git a/demos/sub-attaq/states.cpp b/demos/sub-attaq/states.cpp index 4a9d845..10c173e 100644 --- a/demos/sub-attaq/states.cpp +++ b/demos/sub-attaq/states.cpp @@ -54,7 +54,6 @@ #include #include #include -#include #include PlayState::PlayState(GraphicsScene *scene, QState *parent) @@ -295,7 +294,7 @@ bool UpdateScoreTransition::eventTest(QEvent *event) if (!QSignalTransition::eventTest(event)) return false; else { - QSignalEvent *se = static_cast(event); + QStateMachine::SignalEvent *se = static_cast(event); game->score += se->arguments().at(0).toInt(); scene->progressItem->setScore(game->score); return true; @@ -315,7 +314,7 @@ bool WinTransition::eventTest(QEvent *event) if (!QSignalTransition::eventTest(event)) return false; else { - QSignalEvent *se = static_cast(event); + QStateMachine::SignalEvent *se = static_cast(event); game->score += se->arguments().at(0).toInt(); scene->progressItem->setScore(game->score); return true; diff --git a/doc/src/examples/rogue.qdoc b/doc/src/examples/rogue.qdoc index 3eb9249..4f9dc3f 100644 --- a/doc/src/examples/rogue.qdoc +++ b/doc/src/examples/rogue.qdoc @@ -194,7 +194,7 @@ \snippet examples/statemachine/rogue/movementtransition.h 1 - The KeyPress events come wrapped in \l{QWrappedEvent}s. \c event + The KeyPress events come wrapped in \l{QStateMachine::WrappedEvent}s. \c event must be confirmed to be a wrapped event because Qt uses other events internally. After that, it is simply a matter of checking which key has been pressed. diff --git a/doc/src/frameworks-technologies/statemachine.qdoc b/doc/src/frameworks-technologies/statemachine.qdoc index 904b551..2b137dd 100644 --- a/doc/src/frameworks-technologies/statemachine.qdoc +++ b/doc/src/frameworks-technologies/statemachine.qdoc @@ -308,9 +308,9 @@ A QStateMachine runs its own event loop. For signal transitions (QSignalTransition objects), QStateMachine automatically posts a - QSignalEvent to itself when it intercepts the corresponding signal; - similarly, for QObject event transitions (QEventTransition objects) a - QWrappedEvent is posted. + QStateMachine::SignalEvent to itself when it intercepts the corresponding + signal; similarly, for QObject event transitions (QEventTransition objects) + a QStateMachine::WrappedEvent is posted. You can post your own events to the state machine using QStateMachine::postEvent(). diff --git a/doc/src/snippets/statemachine/eventtest.cpp b/doc/src/snippets/statemachine/eventtest.cpp index b6397ba..817dbfc 100644 --- a/doc/src/snippets/statemachine/eventtest.cpp +++ b/doc/src/snippets/statemachine/eventtest.cpp @@ -52,7 +52,7 @@ protected: bool eventTest(QEvent *event) { if (event->type() == QEvent::Wrapped) { - QEvent *wrappedEvent = static_cast(event)->event(); + QEvent *wrappedEvent = static_cast(event)->event(); if (wrappedEvent->type() == QEvent::KeyPress) { QKeyEvent *keyEvent = static_cast(wrappedEvent); // Do your event test diff --git a/examples/animation/stickman/lifecycle.cpp b/examples/animation/stickman/lifecycle.cpp index f5dca74..250fb85 100644 --- a/examples/animation/stickman/lifecycle.cpp +++ b/examples/animation/stickman/lifecycle.cpp @@ -64,7 +64,7 @@ public: virtual bool eventTest(QEvent *e) { if (QSignalTransition::eventTest(e)) { - QVariant key = static_cast(e)->arguments().at(0); + QVariant key = static_cast(e)->arguments().at(0); return (key.toInt() == int(m_key)); } diff --git a/examples/statemachine/factorial/main.cpp b/examples/statemachine/factorial/main.cpp index 54f4ec0..018b84f 100644 --- a/examples/statemachine/factorial/main.cpp +++ b/examples/statemachine/factorial/main.cpp @@ -98,13 +98,13 @@ public: { if (!QSignalTransition::eventTest(e)) return false; - QSignalEvent *se = static_cast(e); + QStateMachine::SignalEvent *se = static_cast(e); return se->arguments().at(0).toInt() > 1; } virtual void onTransition(QEvent *e) { - QSignalEvent *se = static_cast(e); + QStateMachine::SignalEvent *se = static_cast(e); int x = se->arguments().at(0).toInt(); int fac = m_fact->property("fac").toInt(); m_fact->setProperty("fac", x * fac); @@ -128,7 +128,7 @@ public: { if (!QSignalTransition::eventTest(e)) return false; - QSignalEvent *se = static_cast(e); + QStateMachine::SignalEvent *se = static_cast(e); return se->arguments().at(0).toInt() <= 1; } diff --git a/examples/statemachine/rogue/movementtransition.h b/examples/statemachine/rogue/movementtransition.h index dbaf8d9..b919360 100644 --- a/examples/statemachine/rogue/movementtransition.h +++ b/examples/statemachine/rogue/movementtransition.h @@ -62,8 +62,8 @@ public: protected: bool eventTest(QEvent *event) { if (event->type() == QEvent::Wrapped && - static_cast(event)->event()->type() == QEvent::KeyPress) { - QEvent *wrappedEvent = static_cast(event)->event(); + static_cast(event)->event()->type() == QEvent::KeyPress) { + QEvent *wrappedEvent = static_cast(event)->event(); QKeyEvent *keyEvent = static_cast(wrappedEvent); int key = keyEvent->key(); @@ -78,7 +78,7 @@ protected: //![2] void onTransition(QEvent *event) { QKeyEvent *keyEvent = static_cast( - static_cast(event)->event()); + static_cast(event)->event()); int key = keyEvent->key(); switch (key) { diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp index a7a3b5d..185c305 100644 --- a/src/corelib/kernel/qcoreevent.cpp +++ b/src/corelib/kernel/qcoreevent.cpp @@ -192,6 +192,7 @@ QT_BEGIN_NAMESPACE \value ShortcutOverride Key press in child, for overriding shortcut key handling (QKeyEvent). \value Show Widget was shown on screen (QShowEvent). \value ShowToParent A child widget has been shown. + \value Signal A signal delivered to a state machine (QStateMachine::SignalEvent). \value SockAct Socket activated, used to implement QSocketNotifier. \value StatusTip A status tip is requested (QStatusTipEvent). \value StyleChange Widget's style has been changed. @@ -220,7 +221,7 @@ QT_BEGIN_NAMESPACE \value WindowStateChange The \l{QWidget::windowState()}{window's state} (minimized, maximized or full-screen) has changed (QWindowStateChangeEvent). \value WindowTitleChange The window title has changed. \value WindowUnblocked The window is unblocked after a modal dialog exited. - \value Wrapped The event is a wrapper for, i.e., contains, another event (QWrappedEvent). + \value Wrapped The event is a wrapper for, i.e., contains, another event (QStateMachine::WrappedEvent). \value ZOrderChange The widget's z-order has changed. This event is never sent to top level windows. \value KeyboardLayoutChange The keyboard layout has changed. \value DynamicPropertyChange A dynamic property was added, changed or removed from the object. @@ -269,7 +270,6 @@ QT_BEGIN_NAMESPACE \omitvalue NetworkReplyUpdated \omitvalue FutureCallOut \omitvalue CocoaRequestModal - \omitvalue Signal \omitvalue SymbianDeferredFocusChanged \omitvalue UpdateSoftKeys \omitvalue NativeGesture diff --git a/src/corelib/statemachine/qeventtransition.cpp b/src/corelib/statemachine/qeventtransition.cpp index 2ce7b4a..f278371 100644 --- a/src/corelib/statemachine/qeventtransition.cpp +++ b/src/corelib/statemachine/qeventtransition.cpp @@ -44,7 +44,6 @@ #ifndef QT_NO_STATEMACHINE #include "qeventtransition_p.h" -#include "qwrappedevent.h" #include "qstate.h" #include "qstate_p.h" #include "qstatemachine.h" @@ -83,10 +82,11 @@ QT_BEGIN_NAMESPACE \section1 Subclassing When reimplementing the eventTest() function, you should first call the base - implementation to verify that the event is a QWrappedEvent for the proper - object and event type. You may then cast the event to a QWrappedEvent and - get the original event by calling QWrappedEvent::event(), and perform - additional checks on that object. + implementation to verify that the event is a QStateMachine::WrappedEvent for + the proper object and event type. You may then cast the event to a + QStateMachine::WrappedEvent and get the original event by calling + QStateMachine::WrappedEvent::event(), and perform additional checks on that + object. \sa QState::addTransition() */ @@ -232,7 +232,7 @@ bool QEventTransition::eventTest(QEvent *event) { Q_D(const QEventTransition); if (event->type() == QEvent::Wrapped) { - QWrappedEvent *we = static_cast(event); + QStateMachine::WrappedEvent *we = static_cast(event); return (we->object() == d->object) && (we->event()->type() == d->eventType); } diff --git a/src/corelib/statemachine/qsignalevent.h b/src/corelib/statemachine/qsignalevent.h deleted file mode 100644 index 6d2bd63..0000000 --- a/src/corelib/statemachine/qsignalevent.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSIGNALEVENT_H -#define QSIGNALEVENT_H - -#include - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Core) - -#ifndef QT_NO_STATEMACHINE - -class Q_CORE_EXPORT QSignalEvent : public QEvent -{ -public: - QSignalEvent(QObject *sender, int signalIndex, - const QList &arguments); - ~QSignalEvent(); - - inline QObject *sender() const { return m_sender; } - inline int signalIndex() const { return m_signalIndex; } - inline QList arguments() const { return m_arguments; } - -private: - QObject *m_sender; - int m_signalIndex; - QList m_arguments; - - friend class QSignalTransitionPrivate; -}; - -#endif //QT_NO_STATEMACHINE - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/src/corelib/statemachine/qsignaltransition.cpp b/src/corelib/statemachine/qsignaltransition.cpp index 74655e6..9811725 100644 --- a/src/corelib/statemachine/qsignaltransition.cpp +++ b/src/corelib/statemachine/qsignaltransition.cpp @@ -44,7 +44,6 @@ #ifndef QT_NO_STATEMACHINE #include "qsignaltransition_p.h" -#include "qsignalevent.h" #include "qstate.h" #include "qstate_p.h" #include "qstatemachine.h" @@ -68,7 +67,7 @@ QT_BEGIN_NAMESPACE You can subclass QSignalTransition and reimplement eventTest() to make a signal transition conditional; the event object passed to eventTest() will - be a QSignalEvent object. Example: + be a QStateMachine::SignalEvent object. Example: \code class CheckedTransition : public QSignalTransition @@ -80,7 +79,7 @@ QT_BEGIN_NAMESPACE bool eventTest(QEvent *e) const { if (!QSignalTransition::eventTest(e)) return false; - QSignalEvent *se = static_cast(e); + QStateMachine::SignalEvent *se = static_cast(e); return (se->arguments().at(0).toInt() == Qt::Checked); } }; @@ -212,9 +211,9 @@ void QSignalTransition::setSignal(const QByteArray &signal) /*! \reimp - The \a event is a QSignalEvent object. The default implementation returns - true if the event's sender and signal index match this transition, and - returns false otherwise. + The default implementation returns true if the \a event is a + QStateMachine::SignalEvent object and the event's sender and signal index + match this transition, and returns false otherwise. */ bool QSignalTransition::eventTest(QEvent *event) { @@ -222,7 +221,7 @@ bool QSignalTransition::eventTest(QEvent *event) if (event->type() == QEvent::Signal) { if (d->signalIndex == -1) return false; - QSignalEvent *se = static_cast(event); + QStateMachine::SignalEvent *se = static_cast(event); return (se->sender() == d->sender) && (se->signalIndex() == d->signalIndex); } @@ -250,7 +249,7 @@ void QSignalTransitionPrivate::callOnTransition(QEvent *e) Q_Q(QSignalTransition); if (e->type() == QEvent::Signal) { - QSignalEvent *se = static_cast(e); + QStateMachine::SignalEvent *se = static_cast(e); int savedSignalIndex = se->m_signalIndex; se->m_signalIndex = originalSignalIndex; q->onTransition(e); diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index 7876d43..503eec0 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -50,7 +50,6 @@ #include "qabstracttransition_p.h" #include "qsignaltransition.h" #include "qsignaltransition_p.h" -#include "qsignalevent.h" #include "qsignaleventgenerator_p.h" #include "qabstractstate.h" #include "qabstractstate_p.h" @@ -63,7 +62,6 @@ #ifndef QT_NO_STATEMACHINE_EVENTFILTER #include "qeventtransition.h" #include "qeventtransition_p.h" -#include "qwrappedevent.h" #endif #ifndef QT_NO_ANIMATION @@ -1534,7 +1532,7 @@ void QStateMachinePrivate::handleTransitionSignal(QObject *sender, int signalInd qDebug() << q_func() << ": sending signal event ( sender =" << sender << ", signal =" << sender->metaObject()->method(signalIndex).signature() << ')'; #endif - internalEventQueue.append(new QSignalEvent(sender, signalIndex, vargs)); + internalEventQueue.append(new QStateMachine::SignalEvent(sender, signalIndex, vargs)); scheduleProcess(); } @@ -1880,7 +1878,7 @@ bool QStateMachine::eventFilter(QObject *watched, QEvent *event) Q_D(QStateMachine); Q_ASSERT(d->qobjectEvents.contains(watched)); if (d->qobjectEvents[watched].contains(event->type())) - postEvent(new QWrappedEvent(watched, d->handler->cloneEvent(event))); + postEvent(new QStateMachine::WrappedEvent(watched, d->handler->cloneEvent(event))); return false; } #endif @@ -2076,16 +2074,16 @@ QSignalEventGenerator::QSignalEventGenerator(QStateMachine *parent) } /*! - \class QSignalEvent + \class QStateMachine::SignalEvent - \brief The QSignalEvent class represents a Qt signal event. + \brief The SignalEvent class represents a Qt signal event. \since 4.6 \ingroup statemachine A signal event is generated by a QStateMachine in response to a Qt signal. The QSignalTransition class provides a transition associated with a - signal event. QSignalEvent is part of \l{The State Machine Framework}. + signal event. QStateMachine::SignalEvent is part of \l{The State Machine Framework}. The sender() function returns the object that generated the signal. The signalIndex() function returns the index of the signal. The arguments() @@ -2097,25 +2095,25 @@ QSignalEventGenerator::QSignalEventGenerator(QStateMachine *parent) /*! \internal - Constructs a new QSignalEvent object with the given \a sender, \a + Constructs a new SignalEvent object with the given \a sender, \a signalIndex and \a arguments. */ -QSignalEvent::QSignalEvent(QObject *sender, int signalIndex, - const QList &arguments) +QStateMachine::SignalEvent::SignalEvent(QObject *sender, int signalIndex, + const QList &arguments) : QEvent(QEvent::Signal), m_sender(sender), m_signalIndex(signalIndex), m_arguments(arguments) { } /*! - Destroys this QSignalEvent. + Destroys this SignalEvent. */ -QSignalEvent::~QSignalEvent() +QStateMachine::SignalEvent::~SignalEvent() { } /*! - \fn QSignalEvent::sender() const + \fn QStateMachine::SignalEvent::sender() const Returns the object that emitted the signal. @@ -2123,7 +2121,7 @@ QSignalEvent::~QSignalEvent() */ /*! - \fn QSignalEvent::signalIndex() const + \fn QStateMachine::SignalEvent::signalIndex() const Returns the index of the signal. @@ -2131,23 +2129,24 @@ QSignalEvent::~QSignalEvent() */ /*! - \fn QSignalEvent::arguments() const + \fn QStateMachine::SignalEvent::arguments() const Returns the arguments of the signal. */ /*! - \class QWrappedEvent + \class QStateMachine::WrappedEvent - \brief The QWrappedEvent class holds a clone of an event associated with a QObject. + \brief The WrappedEvent class holds a clone of an event associated with a QObject. \since 4.6 \ingroup statemachine A wrapped event is generated by a QStateMachine in response to a Qt event. The QEventTransition class provides a transition associated with a - such an event. QWrappedEvent is part of \l{The State Machine Framework}. + such an event. QStateMachine::WrappedEvent is part of \l{The State Machine + Framework}. The object() function returns the object that generated the event. The event() function returns a clone of the original event. @@ -2158,32 +2157,32 @@ QSignalEvent::~QSignalEvent() /*! \internal - Constructs a new QWrappedEvent object with the given \a object + Constructs a new WrappedEvent object with the given \a object and \a event. - The QWrappedEvent object takes ownership of \a event. + The WrappedEvent object takes ownership of \a event. */ -QWrappedEvent::QWrappedEvent(QObject *object, QEvent *event) +QStateMachine::WrappedEvent::WrappedEvent(QObject *object, QEvent *event) : QEvent(QEvent::Wrapped), m_object(object), m_event(event) { } /*! - Destroys this QWrappedEvent. + Destroys this WrappedEvent. */ -QWrappedEvent::~QWrappedEvent() +QStateMachine::WrappedEvent::~WrappedEvent() { delete m_event; } /*! - \fn QWrappedEvent::object() const + \fn QStateMachine::WrappedEvent::object() const Returns the object that the event is associated with. */ /*! - \fn QWrappedEvent::event() const + \fn QStateMachine::WrappedEvent::event() const Returns a clone of the original event. */ diff --git a/src/corelib/statemachine/qstatemachine.h b/src/corelib/statemachine/qstatemachine.h index dd524dd..a0b2b14 100644 --- a/src/corelib/statemachine/qstatemachine.h +++ b/src/corelib/statemachine/qstatemachine.h @@ -44,6 +44,7 @@ #include +#include #include #include #include @@ -56,8 +57,6 @@ QT_MODULE(Core) #ifndef QT_NO_STATEMACHINE -class QEvent; - class QStateMachinePrivate; class QAbstractAnimation; class Q_CORE_EXPORT QStateMachine : public QState @@ -70,6 +69,39 @@ class Q_CORE_EXPORT QStateMachine : public QState Q_PROPERTY(bool animationsEnabled READ animationsEnabled WRITE setAnimationsEnabled) #endif public: + class SignalEvent : public QEvent + { + public: + SignalEvent(QObject *sender, int signalIndex, + const QList &arguments); + ~SignalEvent(); + + inline QObject *sender() const { return m_sender; } + inline int signalIndex() const { return m_signalIndex; } + inline QList arguments() const { return m_arguments; } + + private: + QObject *m_sender; + int m_signalIndex; + QList m_arguments; + + friend class QSignalTransitionPrivate; + }; + + class WrappedEvent : public QEvent + { + public: + WrappedEvent(QObject *object, QEvent *event); + ~WrappedEvent(); + + inline QObject *object() const { return m_object; } + inline QEvent *event() const { return m_event; } + + private: + QObject *m_object; + QEvent *m_event; + }; + enum RestorePolicy { DoNotRestoreProperties, RestoreProperties diff --git a/src/corelib/statemachine/qwrappedevent.h b/src/corelib/statemachine/qwrappedevent.h deleted file mode 100644 index e0a131b..0000000 --- a/src/corelib/statemachine/qwrappedevent.h +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWRAPPEDEVENT_H -#define QWRAPPEDEVENT_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Core) - -#ifndef QT_NO_STATEMACHINE - -class QObject; - -class Q_CORE_EXPORT QWrappedEvent : public QEvent -{ -public: - QWrappedEvent(QObject *object, QEvent *event); - ~QWrappedEvent(); - - inline QObject *object() const { return m_object; } - inline QEvent *event() const { return m_event; } - -private: - QObject *m_object; - QEvent *m_event; - -private: - Q_DISABLE_COPY(QWrappedEvent) -}; - -#endif //QT_NO_STATEMACHINE - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/src/corelib/statemachine/statemachine.pri b/src/corelib/statemachine/statemachine.pri index 5b19bc1..910cf5e 100644 --- a/src/corelib/statemachine/statemachine.pri +++ b/src/corelib/statemachine/statemachine.pri @@ -10,7 +10,6 @@ HEADERS += $$PWD/qstatemachine.h \ $$PWD/qhistorystate_p.h \ $$PWD/qabstracttransition.h \ $$PWD/qabstracttransition_p.h \ - $$PWD/qsignalevent.h \ $$PWD/qsignaltransition.h \ $$PWD/qsignaltransition_p.h @@ -23,8 +22,7 @@ SOURCES += $$PWD/qstatemachine.cpp \ $$PWD/qsignaltransition.cpp !contains(DEFINES, QT_NO_STATEMACHINE_EVENTFILTER) { -HEADERS += $$PWD/qwrappedevent.h \ - $$PWD/qeventtransition.h \ +HEADERS += $$PWD/qeventtransition.h \ $$PWD/qeventtransition_p.h SOURCES += $$PWD/qeventtransition.cpp } diff --git a/src/gui/statemachine/qkeyeventtransition.cpp b/src/gui/statemachine/qkeyeventtransition.cpp index 825b2ec..dee3168 100644 --- a/src/gui/statemachine/qkeyeventtransition.cpp +++ b/src/gui/statemachine/qkeyeventtransition.cpp @@ -44,7 +44,7 @@ #ifndef QT_NO_STATEMACHINE #include "qbasickeyeventtransition_p.h" -#include +#include #include QT_BEGIN_NAMESPACE @@ -160,7 +160,7 @@ bool QKeyEventTransition::eventTest(QEvent *event) Q_D(const QKeyEventTransition); if (!QEventTransition::eventTest(event)) return false; - QWrappedEvent *we = static_cast(event); + QStateMachine::WrappedEvent *we = static_cast(event); d->transition->setEventType(we->event()->type()); return QAbstractTransitionPrivate::get(d->transition)->callEventTest(we->event()); } diff --git a/src/gui/statemachine/qmouseeventtransition.cpp b/src/gui/statemachine/qmouseeventtransition.cpp index 564c8d2..86cacf7 100644 --- a/src/gui/statemachine/qmouseeventtransition.cpp +++ b/src/gui/statemachine/qmouseeventtransition.cpp @@ -44,7 +44,7 @@ #ifndef QT_NO_STATEMACHINE #include "qbasicmouseeventtransition_p.h" -#include +#include #include #include @@ -188,7 +188,7 @@ bool QMouseEventTransition::eventTest(QEvent *event) Q_D(const QMouseEventTransition); if (!QEventTransition::eventTest(event)) return false; - QWrappedEvent *we = static_cast(event); + QStateMachine::WrappedEvent *we = static_cast(event); d->transition->setEventType(we->event()->type()); return QAbstractTransitionPrivate::get(d->transition)->callEventTest(we->event()); } diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index a3f2f54..1fae92b 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -1754,7 +1754,7 @@ protected: bool eventTest(QEvent *e) { if (!QSignalTransition::eventTest(e)) return false; - QSignalEvent *se = static_cast(e); + QStateMachine::SignalEvent *se = static_cast(e); const_cast(this)->m_args = se->arguments(); return true; } @@ -3954,7 +3954,7 @@ public: void onTransition(QEvent *e) { QSignalTransition::onTransition(e); - QSignalEvent *se = static_cast(e); + QStateMachine::SignalEvent *se = static_cast(e); eventSignalIndex = se->signalIndex(); } -- cgit v0.12