summaryrefslogtreecommitdiffstats
path: root/examples/statemachine/citizenquartz/propertyaddstate.h
diff options
context:
space:
mode:
Diffstat (limited to 'examples/statemachine/citizenquartz/propertyaddstate.h')
-rw-r--r--examples/statemachine/citizenquartz/propertyaddstate.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/examples/statemachine/citizenquartz/propertyaddstate.h b/examples/statemachine/citizenquartz/propertyaddstate.h
new file mode 100644
index 0000000..96f45fc
--- /dev/null
+++ b/examples/statemachine/citizenquartz/propertyaddstate.h
@@ -0,0 +1,33 @@
+#ifndef PropertyAddState_H
+#define PropertyAddState_H
+
+#include <qstate.h>
+
+#include <QVariant>
+#include <QList>
+
+class PropertyAddState: public QState
+{
+public:
+ PropertyAddState(QState *parent = 0);
+
+ void addToProperty(QObject *object, const char *propertyName, const QVariant &valueToAdd);
+ virtual void onEntry();
+
+private:
+ QVariant addProperties(const QVariant &current, const QVariant &toAdd) const;
+
+ struct PropertyAdder {
+ PropertyAdder(QObject *_object, const char *_propertyName, const QVariant &_valueToAdd)
+ : object(_object), propertyName(_propertyName), valueToAdd(_valueToAdd)
+ {
+ }
+
+ QObject *object;
+ const char *propertyName;
+ QVariant valueToAdd;
+ };
+ QList<PropertyAdder> m_propertyAdditions;
+};
+
+#endif // PropertyAddState_H