diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-04-29 06:25:03 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-04-29 06:29:47 (GMT) |
commit | f810a0210c0cdd1ba070f16ebebdec1da7c72b50 (patch) | |
tree | 37e76a3e7fb70b41aab0fa250aaeb0c731571108 /src/corelib/statemachine/qhistorystate.h | |
parent | 2c22f8748f62db3cd4c2782abcd19c273f4a4426 (diff) | |
download | Qt-f810a0210c0cdd1ba070f16ebebdec1da7c72b50.zip Qt-f810a0210c0cdd1ba070f16ebebdec1da7c72b50.tar.gz Qt-f810a0210c0cdd1ba070f16ebebdec1da7c72b50.tar.bz2 |
make history state constructible
Decided in API review. The intention of QHistoryState not being
constructible was so that people wouldn't subclass it and reimplement
onEntry()/onExit(), thinking that those functions would actually get
called (which they won't). However, we recently added the entered()
signal to QAbstractState, so people are going to connect to it and
ask why they never get the signal for a QHistoryState. We might as
well make QHistoryState constructible and just document that it
doesn't make sense to subclass it.
Diffstat (limited to 'src/corelib/statemachine/qhistorystate.h')
-rw-r--r-- | src/corelib/statemachine/qhistorystate.h | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/corelib/statemachine/qhistorystate.h b/src/corelib/statemachine/qhistorystate.h index 9cd7f0b..c7648bc 100644 --- a/src/corelib/statemachine/qhistorystate.h +++ b/src/corelib/statemachine/qhistorystate.h @@ -43,9 +43,9 @@ #define QHISTORYSTATE_H #ifndef QT_STATEMACHINE_SOLUTION -#include <QtCore/qstate.h> +#include <QtCore/qabstractstate.h> #else -#include "qstate.h" +#include "qabstractstate.h" #endif QT_BEGIN_HEADER @@ -58,12 +58,25 @@ class QHistoryStatePrivate; class Q_CORE_EXPORT QHistoryState : public QAbstractState { Q_OBJECT + Q_PROPERTY(QAbstractState* defaultState READ defaultState WRITE setDefaultState) + Q_PROPERTY(HistoryType historyType READ historyType WRITE setHistoryType) + Q_ENUMS(HistoryType) public: + enum HistoryType { + ShallowHistory, + DeepHistory + }; + + QHistoryState(QState *parent = 0); + QHistoryState(HistoryType type, QState *parent = 0); ~QHistoryState(); QAbstractState *defaultState() const; void setDefaultState(QAbstractState *state); + HistoryType historyType() const; + void setHistoryType(HistoryType type); + protected: void onEntry(); void onExit(); @@ -71,10 +84,6 @@ protected: bool event(QEvent *e); private: - QHistoryState(QState::HistoryType type, - QState *parent = 0); - -private: Q_DISABLE_COPY(QHistoryState) Q_DECLARE_PRIVATE(QHistoryState) }; |