Qt 4.8
qhistorystate.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtCore module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #include "qhistorystate.h"
43 
44 #ifndef QT_NO_STATEMACHINE
45 
46 #include "qhistorystate_p.h"
47 
49 
135  : QAbstractStatePrivate(HistoryState),
136  defaultState(0), historyType(QHistoryState::ShallowHistory)
137 {
138 }
139 
141 {
142  return q->d_func();
143 }
144 
149  : QAbstractState(*new QHistoryStatePrivate, parent)
150 {
151 }
157  : QAbstractState(*new QHistoryStatePrivate, parent)
158 {
160  d->historyType = type;
161 }
162 
167 {
168 }
169 
175 {
176  Q_D(const QHistoryState);
177  return d->defaultState;
178 }
179 
188 {
190  if (state && state->parentState() != parentState()) {
191  qWarning("QHistoryState::setDefaultState: state %p does not belong "
192  "to this history state's group (%p)", state, parentState());
193  return;
194  }
195  d->defaultState = state;
196 }
197 
202 {
203  Q_D(const QHistoryState);
204  return d->historyType;
205 }
206 
211 {
213  d->historyType = type;
214 }
215 
220 {
221  Q_UNUSED(event);
222 }
223 
228 {
229  Q_UNUSED(event);
230 }
231 
236 {
237  return QAbstractState::event(e);
238 }
239 
241 
242 #endif //QT_NO_STATEMACHINE
double d
Definition: qnumeric_p.h:62
int type
Definition: qmetatype.cpp:239
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
QState * parentState() const
Returns this state's parent state, or 0 if the state has no parent state.
void setHistoryType(HistoryType type)
Sets the type of history that this history state records.
HistoryType
This enum specifies the type of history that a QHistoryState records.
Definition: qhistorystate.h:63
QHistoryState(QState *parent=0)
Constructs a new shallow history state with the given parent state.
#define Q_D(Class)
Definition: qglobal.h:2482
The QState class provides a general-purpose state for QStateMachine.
Definition: qstate.h:61
bool event(QEvent *e)
Reimplemented Function
~QHistoryState()
Destroys this history state.
void onEntry(QEvent *event)
Reimplemented Function
static QHistoryStatePrivate * get(QHistoryState *q)
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
HistoryType historyType() const
The QAbstractState class is the base class of states of a QStateMachine.
Q_CORE_EXPORT void qWarning(const char *,...)
void onExit(QEvent *event)
Reimplemented Function
The QHistoryState class provides a means of returning to a previously active substate.
Definition: qhistorystate.h:56
void setDefaultState(QAbstractState *state)
Sets this history state's default state to be the given state.
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
QObject * parent
Definition: qobject.h:92
QAbstractState * defaultState() const
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
bool event(QEvent *e)
Reimplemented Function