From 9bb27ca6cc76a848d9c4a1d7757abf5ffc3943e6 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 31 Jul 2018 12:36:47 -0700 Subject: Make local symbols of some leaked names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unnamed namespaces and static are great tools. Use them. Change-Id: Ie01831ddac5446fdbdeefffd15468b3acb3ced79 Reviewed-by: Kai Koehne Reviewed-by: André Hartmann Reviewed-by: Edward Welbourne --- src/corelib/statemachine/qhistorystate.cpp | 21 ++++++++++++++++++++- src/corelib/statemachine/qhistorystate_p.h | 17 ----------------- 2 files changed, 20 insertions(+), 18 deletions(-) (limited to 'src/corelib/statemachine') diff --git a/src/corelib/statemachine/qhistorystate.cpp b/src/corelib/statemachine/qhistorystate.cpp index d4fb214a31..ccf04d4799 100644 --- a/src/corelib/statemachine/qhistorystate.cpp +++ b/src/corelib/statemachine/qhistorystate.cpp @@ -126,6 +126,25 @@ QT_BEGIN_NAMESPACE descendant state the parent was in the last time it was exited. */ +namespace { +class DefaultStateTransition: public QAbstractTransition +{ + Q_OBJECT + +public: + DefaultStateTransition(QHistoryState *source, QAbstractState *target); + +protected: + // It doesn't matter whether this transition matches any event or not. It is always associated + // with a QHistoryState, and as soon as the state-machine detects that it enters a history + // state, it will handle this transition as a special case. The history state itself is never + // entered either: either the stored configuration will be used, or the target(s) of this + // transition are used. + bool eventTest(QEvent *event) override { Q_UNUSED(event); return false; } + void onTransition(QEvent *event) override { Q_UNUSED(event); } +}; +} + QHistoryStatePrivate::QHistoryStatePrivate() : QAbstractStatePrivate(HistoryState) , defaultTransition(0) @@ -312,4 +331,4 @@ bool QHistoryState::event(QEvent *e) QT_END_NAMESPACE #include "moc_qhistorystate.cpp" -#include "moc_qhistorystate_p.cpp" +#include "qhistorystate.moc" diff --git a/src/corelib/statemachine/qhistorystate_p.h b/src/corelib/statemachine/qhistorystate_p.h index d22e5c4aaf..18d571feb7 100644 --- a/src/corelib/statemachine/qhistorystate_p.h +++ b/src/corelib/statemachine/qhistorystate_p.h @@ -75,23 +75,6 @@ public: QList configuration; }; -class DefaultStateTransition: public QAbstractTransition -{ - Q_OBJECT - -public: - DefaultStateTransition(QHistoryState *source, QAbstractState *target); - -protected: - // It doesn't matter whether this transition matches any event or not. It is always associated - // with a QHistoryState, and as soon as the state-machine detects that it enters a history - // state, it will handle this transition as a special case. The history state itself is never - // entered either: either the stored configuration will be used, or the target(s) of this - // transition are used. - bool eventTest(QEvent *event) override { Q_UNUSED(event); return false; } - void onTransition(QEvent *event) override { Q_UNUSED(event); } -}; - QT_END_NAMESPACE #endif // QHISTORYSTATE_P_H -- cgit v1.2.3