summaryrefslogtreecommitdiffstats
path: root/src/corelib/statemachine/qstatemachine_p.h
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-01-04 22:18:29 +0100
committerMarc Mutz <marc.mutz@kdab.com>2016-01-05 10:28:09 +0000
commit32bd53c6b10b505a32d2940f9c0c8a7d3e85abf3 (patch)
tree2722e3d8d87b63067d2195581ad0b295dcb1226a /src/corelib/statemachine/qstatemachine_p.h
parent01d8abdbf1bdeed9efe706318c5798c4f1e9b104 (diff)
QStateMachine: replace a QPair with a small struct
The use of QPair made the return type of initializeAnimation() so complicated, that the original author opted to declare the pair on one line, then assign to it in the next, to keep below the line length limit. She also copied a member of the pair just so as to give it a descriptive name. Fix both by introducing a small result struct. It has a nicer name, compared to the pair, but still port callers to use 'auto'. The member names are descriptive enough now. Saves more than 0.5KiB in text size on optimized GCC 4.9 Linux AMD64 builds, too. Change-Id: I7ed007ffa0fb16e182e38cd405cfd54da4e363fb Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
Diffstat (limited to 'src/corelib/statemachine/qstatemachine_p.h')
-rw-r--r--src/corelib/statemachine/qstatemachine_p.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/corelib/statemachine/qstatemachine_p.h b/src/corelib/statemachine/qstatemachine_p.h
index 45c6dfcb33..98f7bbd90b 100644
--- a/src/corelib/statemachine/qstatemachine_p.h
+++ b/src/corelib/statemachine/qstatemachine_p.h
@@ -259,7 +259,18 @@ public:
#ifndef QT_NO_ANIMATION
bool animated;
- QPair<QList<QAbstractAnimation*>, QList<QAbstractAnimation*> >
+ struct InitializeAnimationResult {
+ QList<QAbstractAnimation*> handledAnimations;
+ QList<QAbstractAnimation*> localResetEndValues;
+
+ void swap(InitializeAnimationResult &other) Q_DECL_NOTHROW
+ {
+ qSwap(handledAnimations, other.handledAnimations);
+ qSwap(localResetEndValues, other.localResetEndValues);
+ }
+ };
+
+ InitializeAnimationResult
initializeAnimation(QAbstractAnimation *abstractAnimation,
const QPropertyAssignment &prop);
@@ -307,6 +318,7 @@ public:
static const Handler *handler;
};
+Q_DECLARE_SHARED(QStateMachinePrivate::InitializeAnimationResult)
Q_CORE_EXPORT const QStateMachinePrivate::Handler *qcoreStateMachineHandler();