Fix build with statemachine feature disabled

The sources of the state machine are excluded completely at the build
system level instead of littering them with #ifs.

All remaining usages of QT_NO_STATEMACHINE are converted to
QT_CONFIG(statemachine) or a QT_REQUIRE_CONFIG(statemachine).

Also make the qeventtransition feature dependent on statemachine.

Change-Id: Ib05c7ca263a02042523fff8f794fa87342df1069
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
bb10
Lars Knoll 2016-08-30 12:23:53 +02:00
parent 267dd9133d
commit 8d330f55ba
38 changed files with 51 additions and 146 deletions

View File

@ -353,6 +353,7 @@
},
"qeventtransition": {
"label": "QEventTransition class",
"condition": "features.statemachine",
"output": [ "publicFeature" ]
},
"sharedmemory": {

View File

@ -38,9 +38,6 @@
****************************************************************************/
#include "qabstractstate.h"
#ifndef QT_NO_STATEMACHINE
#include "qabstractstate_p.h"
#include "qstate.h"
#include "qstate_p.h"
@ -237,5 +234,3 @@ bool QAbstractState::event(QEvent *e)
}
QT_END_NAMESPACE
#endif //QT_NO_STATEMACHINE

View File

@ -42,11 +42,10 @@
#include <QtCore/qobject.h>
QT_REQUIRE_CONFIG(statemachine);
QT_BEGIN_NAMESPACE
#ifndef QT_NO_STATEMACHINE
class QState;
class QStateMachine;
@ -84,8 +83,6 @@ private:
Q_DECLARE_PRIVATE(QAbstractState)
};
#endif //QT_NO_STATEMACHINE
QT_END_NAMESPACE
#endif

View File

@ -51,13 +51,11 @@
// We mean it.
//
#include <QtCore/qglobal.h>
#ifndef QT_NO_STATEMACHINE
#include <private/qobject_p.h>
#include <QtCore/qabstractstate.h>
QT_REQUIRE_CONFIG(statemachine);
QT_BEGIN_NAMESPACE
class QStateMachine;
@ -98,6 +96,4 @@ public:
QT_END_NAMESPACE
#endif // QT_NO_STATEMACHINE
#endif // QABSTRACTSTATE_P_H

View File

@ -38,9 +38,6 @@
****************************************************************************/
#include "qabstracttransition.h"
#ifndef QT_NO_STATEMACHINE
#include "qabstracttransition_p.h"
#include "qabstractstate.h"
#include "qhistorystate.h"
@ -434,5 +431,3 @@ bool QAbstractTransition::event(QEvent *e)
}
QT_END_NAMESPACE
#endif //QT_NO_STATEMACHINE

View File

@ -44,11 +44,10 @@
#include <QtCore/qlist.h>
QT_REQUIRE_CONFIG(statemachine);
QT_BEGIN_NAMESPACE
#ifndef QT_NO_STATEMACHINE
class QEvent;
class QAbstractState;
class QState;
@ -113,8 +112,6 @@ private:
Q_DECLARE_PRIVATE(QAbstractTransition)
};
#endif //QT_NO_STATEMACHINE
QT_END_NAMESPACE
#endif

View File

@ -57,6 +57,8 @@
#include <QtCore/qvector.h>
#include <QtCore/qsharedpointer.h>
QT_REQUIRE_CONFIG(statemachine);
QT_BEGIN_NAMESPACE
class QAbstractState;

View File

@ -38,9 +38,6 @@
****************************************************************************/
#include "qeventtransition.h"
#ifndef QT_NO_STATEMACHINE
#include "qeventtransition_p.h"
#include "qstate.h"
#include "qstate_p.h"
@ -255,5 +252,3 @@ bool QEventTransition::event(QEvent *e)
}
QT_END_NAMESPACE
#endif //QT_NO_STATEMACHINE

View File

@ -43,11 +43,10 @@
#include <QtCore/qabstracttransition.h>
#include <QtCore/qcoreevent.h>
QT_REQUIRE_CONFIG(qeventtransition);
QT_BEGIN_NAMESPACE
#ifndef QT_NO_STATEMACHINE
class QEventTransitionPrivate;
class Q_CORE_EXPORT QEventTransition : public QAbstractTransition
{
@ -81,8 +80,6 @@ private:
Q_DECLARE_PRIVATE(QEventTransition)
};
#endif //QT_NO_STATEMACHINE
QT_END_NAMESPACE
#endif

View File

@ -53,6 +53,8 @@
#include "private/qabstracttransition_p.h"
QT_REQUIRE_CONFIG(qeventtransition);
QT_BEGIN_NAMESPACE
class QEventTransition;

View File

@ -39,8 +39,6 @@
#include "qfinalstate_p.h"
#ifndef QT_NO_STATEMACHINE
QT_BEGIN_NAMESPACE
/*!
@ -139,5 +137,3 @@ bool QFinalState::event(QEvent *e)
}
QT_END_NAMESPACE
#endif //QT_NO_STATEMACHINE

View File

@ -42,9 +42,9 @@
#include <QtCore/qabstractstate.h>
QT_BEGIN_NAMESPACE
QT_REQUIRE_CONFIG(statemachine);
#ifndef QT_NO_STATEMACHINE
QT_BEGIN_NAMESPACE
class QFinalStatePrivate;
class Q_CORE_EXPORT QFinalState : public QAbstractState
@ -68,8 +68,6 @@ private:
Q_DECLARE_PRIVATE(QFinalState)
};
#endif //QT_NO_STATEMACHINE
QT_END_NAMESPACE
#endif

View File

@ -48,7 +48,7 @@
#include "qfinalstate.h"
#include "private/qabstractstate_p.h"
#ifndef QT_NO_STATEMACHINE
QT_REQUIRE_CONFIG(statemachine);
QT_BEGIN_NAMESPACE
@ -63,6 +63,4 @@ public:
QT_END_NAMESPACE
#endif // QT_NO_STATEMACHINE
#endif // QFINALSTATE_P_H

View File

@ -38,9 +38,6 @@
****************************************************************************/
#include "qhistorystate.h"
#ifndef QT_NO_STATEMACHINE
#include "qhistorystate_p.h"
QT_BEGIN_NAMESPACE
@ -313,5 +310,3 @@ bool QHistoryState::event(QEvent *e)
*/
QT_END_NAMESPACE
#endif //QT_NO_STATEMACHINE

View File

@ -42,11 +42,10 @@
#include <QtCore/qabstractstate.h>
QT_REQUIRE_CONFIG(statemachine);
QT_BEGIN_NAMESPACE
#ifndef QT_NO_STATEMACHINE
class QAbstractTransition;
class QHistoryStatePrivate;
class Q_CORE_EXPORT QHistoryState : public QAbstractState
@ -91,8 +90,6 @@ private:
Q_DECLARE_PRIVATE(QHistoryState)
};
#endif //QT_NO_STATEMACHINE
QT_END_NAMESPACE
#endif

View File

@ -52,13 +52,12 @@
//
#include "private/qabstractstate_p.h"
#ifndef QT_NO_STATEMACHINE
#include <QtCore/qabstracttransition.h>
#include <QtCore/qhistorystate.h>
#include <QtCore/qlist.h>
QT_REQUIRE_CONFIG(statemachine);
QT_BEGIN_NAMESPACE
class QHistoryStatePrivate : public QAbstractStatePrivate
@ -95,6 +94,4 @@ protected:
QT_END_NAMESPACE
#endif // QT_NO_STATEMACHINE
#endif // QHISTORYSTATE_P_H

View File

@ -54,6 +54,8 @@
#include <QtCore/private/qglobal_p.h>
#include <QtCore/qobject.h>
QT_REQUIRE_CONFIG(statemachine);
QT_BEGIN_NAMESPACE
class QStateMachine;

View File

@ -38,9 +38,6 @@
****************************************************************************/
#include "qsignaltransition.h"
#ifndef QT_NO_STATEMACHINE
#include "qsignaltransition_p.h"
#include "qstate.h"
#include "qstate_p.h"
@ -287,5 +284,3 @@ void QSignalTransitionPrivate::callOnTransition(QEvent *e)
QT_END_NAMESPACE
#endif //QT_NO_STATEMACHINE

View File

@ -43,11 +43,10 @@
#include <QtCore/qabstracttransition.h>
#include <QtCore/qmetaobject.h>
QT_REQUIRE_CONFIG(statemachine);
QT_BEGIN_NAMESPACE
#ifndef QT_NO_STATEMACHINE
class QSignalTransitionPrivate;
class Q_CORE_EXPORT QSignalTransition : public QAbstractTransition
{
@ -95,8 +94,6 @@ private:
Q_DECLARE_PRIVATE(QSignalTransition)
};
#endif //QT_NO_STATEMACHINE
QT_END_NAMESPACE
#endif

View File

@ -53,6 +53,8 @@
#include "private/qabstracttransition_p.h"
QT_REQUIRE_CONFIG(statemachine);
QT_BEGIN_NAMESPACE
class QSignalTransition;

View File

@ -38,9 +38,6 @@
****************************************************************************/
#include "qstate_p.h"
#ifndef QT_NO_STATEMACHINE
#include "qhistorystate.h"
#include "qhistorystate_p.h"
#include "qabstracttransition.h"
@ -602,5 +599,3 @@ bool QState::event(QEvent *e)
*/
QT_END_NAMESPACE
#endif //QT_NO_STATEMACHINE

View File

@ -44,11 +44,10 @@
#include <QtCore/qlist.h>
#include <QtCore/qmetaobject.h>
QT_REQUIRE_CONFIG(statemachine);
QT_BEGIN_NAMESPACE
#ifndef QT_NO_STATEMACHINE
class QAbstractTransition;
class QSignalTransition;
@ -130,8 +129,6 @@ private:
Q_DECLARE_PRIVATE(QState)
};
#endif //QT_NO_STATEMACHINE
QT_END_NAMESPACE
#endif

View File

@ -59,7 +59,7 @@
#include <QtCore/qpointer.h>
#include <QtCore/qvariant.h>
#ifndef QT_NO_STATEMACHINE
QT_REQUIRE_CONFIG(statemachine);
QT_BEGIN_NAMESPACE
@ -124,6 +124,4 @@ public:
QT_END_NAMESPACE
#endif // QT_NO_STATEMACHINE
#endif

View File

@ -38,9 +38,6 @@
****************************************************************************/
#include "qstatemachine.h"
#ifndef QT_NO_STATEMACHINE
#include "qstate.h"
#include "qstate_p.h"
#include "qstatemachine_p.h"
@ -3235,5 +3232,3 @@ QT_END_NAMESPACE
#include "qstatemachine.moc"
#include "moc_qstatemachine.cpp"
#endif //QT_NO_STATEMACHINE

View File

@ -48,11 +48,10 @@
#include <QtCore/qset.h>
#include <QtCore/qvariant.h>
QT_REQUIRE_CONFIG(statemachine);
QT_BEGIN_NAMESPACE
#ifndef QT_NO_STATEMACHINE
class QStateMachinePrivate;
class QAbstractAnimation;
class Q_CORE_EXPORT QStateMachine : public QState
@ -183,8 +182,6 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_killDelayedEventTimer(int, int))
};
#endif //QT_NO_STATEMACHINE
QT_END_NAMESPACE
#endif

View File

@ -63,6 +63,8 @@
#include <QtCore/qvector.h>
#include <private/qfreelist_p.h>
QT_REQUIRE_CONFIG(statemachine);
QT_BEGIN_NAMESPACE
class QEvent;

View File

@ -1,3 +1,5 @@
!qtConfig(statemachine): return()
HEADERS += $$PWD/qstatemachine.h \
$$PWD/qstatemachine_p.h \
$$PWD/qsignaleventgenerator_p.h \

View File

@ -608,7 +608,7 @@ void qt_init_tooltip_palette()
#endif
}
#ifndef QT_NO_STATEMACHINE
#if QT_CONFIG(statemachine)
void qRegisterGuiStateMachine();
void qUnregisterGuiStateMachine();
#endif
@ -634,7 +634,7 @@ void QApplicationPrivate::initialize()
if (application_type != QApplicationPrivate::Tty)
(void) QApplication::style(); // trigger creation of application style
#ifndef QT_NO_STATEMACHINE
#if QT_CONFIG(statemachine)
// trigger registering of QStateMachine's GUI types
qRegisterGuiStateMachine();
#endif
@ -862,7 +862,7 @@ QApplication::~QApplication()
QApplicationPrivate::enabledAnimations = QPlatformTheme::GeneralUiEffect;
QApplicationPrivate::widgetCount = false;
#ifndef QT_NO_STATEMACHINE
#if QT_CONFIG(statemachine)
// trigger unregistering of QStateMachine's GUI types
qUnregisterGuiStateMachine();
#endif

View File

@ -39,8 +39,6 @@
#include "qbasickeyeventtransition_p.h"
#ifndef QT_NO_STATEMACHINE
#include <QtGui/qevent.h>
#include <qdebug.h>
#include <private/qabstracttransition_p.h>
@ -204,5 +202,3 @@ void QBasicKeyEventTransition::onTransition(QEvent *)
QT_END_NAMESPACE
#include "moc_qbasickeyeventtransition_p.cpp"
#endif //QT_NO_STATEMACHINE

View File

@ -51,13 +51,11 @@
// We mean it.
//
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtCore/qabstracttransition.h>
#ifndef QT_NO_STATEMACHINE
#include <QtGui/qevent.h>
QT_REQUIRE_CONFIG(qeventtransition);
QT_BEGIN_NAMESPACE
class QBasicKeyEventTransitionPrivate;
@ -92,6 +90,4 @@ private:
QT_END_NAMESPACE
#endif //QT_NO_STATEMACHINE
#endif

View File

@ -38,9 +38,6 @@
****************************************************************************/
#include "qbasicmouseeventtransition_p.h"
#ifndef QT_NO_STATEMACHINE
#include <QtGui/qevent.h>
#include <QtGui/qpainterpath.h>
#include <qdebug.h>
@ -209,5 +206,3 @@ void QBasicMouseEventTransition::onTransition(QEvent *)
QT_END_NAMESPACE
#include "moc_qbasicmouseeventtransition_p.cpp"
#endif //QT_NO_STATEMACHINE

View File

@ -51,13 +51,11 @@
// We mean it.
//
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtCore/qabstracttransition.h>
#ifndef QT_NO_STATEMACHINE
#include <QtGui/qevent.h>
QT_REQUIRE_CONFIG(qeventtransition);
QT_BEGIN_NAMESPACE
class QPainterPath;
@ -95,6 +93,4 @@ private:
QT_END_NAMESPACE
#endif //QT_NO_STATEMACHINE
#endif

View File

@ -38,9 +38,6 @@
****************************************************************************/
#include <QtCore/qstatemachine.h>
#ifndef QT_NO_STATEMACHINE
#include <private/qstatemachine_p.h>
#include <QtGui/qevent.h>
#include <QtWidgets/qgraphicssceneevent.h>
@ -471,5 +468,3 @@ void qUnregisterGuiStateMachine()
Q_DESTRUCTOR_FUNCTION(qUnregisterGuiStateMachine)
QT_END_NAMESPACE
#endif //QT_NO_STATEMACHINE

View File

@ -38,9 +38,6 @@
****************************************************************************/
#include "qkeyeventtransition.h"
#ifndef QT_NO_STATEMACHINE
#include "qbasickeyeventtransition_p.h"
#include <QtCore/qstatemachine.h>
#include <private/qeventtransition_p.h>
@ -175,5 +172,3 @@ void QKeyEventTransition::onTransition(QEvent *event)
QT_END_NAMESPACE
#include "moc_qkeyeventtransition.cpp"
#endif //QT_NO_STATEMACHINE

View File

@ -43,11 +43,10 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qeventtransition.h>
QT_REQUIRE_CONFIG(qeventtransition);
QT_BEGIN_NAMESPACE
#ifndef QT_NO_STATEMACHINE
class QKeyEventTransitionPrivate;
class Q_WIDGETS_EXPORT QKeyEventTransition : public QEventTransition
{
@ -75,8 +74,6 @@ private:
Q_DECLARE_PRIVATE(QKeyEventTransition)
};
#endif //QT_NO_STATEMACHINE
QT_END_NAMESPACE
#endif

View File

@ -38,9 +38,6 @@
****************************************************************************/
#include "qmouseeventtransition.h"
#ifndef QT_NO_STATEMACHINE
#include "qbasicmouseeventtransition_p.h"
#include <QtCore/qstatemachine.h>
#include <QtGui/qpainterpath.h>
@ -203,5 +200,3 @@ void QMouseEventTransition::onTransition(QEvent *event)
QT_END_NAMESPACE
#include "moc_qmouseeventtransition.cpp"
#endif //QT_NO_STATEMACHINE

View File

@ -43,11 +43,10 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qeventtransition.h>
QT_REQUIRE_CONFIG(qeventtransition);
QT_BEGIN_NAMESPACE
#ifndef QT_NO_STATEMACHINE
class QMouseEventTransitionPrivate;
class QPainterPath;
class Q_WIDGETS_EXPORT QMouseEventTransition : public QEventTransition
@ -79,8 +78,6 @@ private:
Q_DECLARE_PRIVATE(QMouseEventTransition)
};
#endif //QT_NO_STATEMACHINE
QT_END_NAMESPACE
#endif

View File

@ -1,5 +1,8 @@
SOURCES += $$PWD/qguistatemachine.cpp
!contains(DEFINES, QT_NO_STATEMACHINE_EVENTFILTER) {
qtConfig(statemachine): \
SOURCES += $$PWD/qguistatemachine.cpp
qtConfig(qeventtransition) {
HEADERS += \
$$PWD/qkeyeventtransition.h \
$$PWD/qmouseeventtransition.h \