Line | Source Code | Coverage |
---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - |
4 | ** Contact: http://www.qt-project.org/legal | - |
5 | ** | - |
6 | ** This file is part of the QtGui 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 "qkeyeventtransition.h" | - |
43 | | - |
44 | #ifndef QT_NO_STATEMACHINE | - |
45 | | - |
46 | #include "qbasickeyeventtransition_p.h" | - |
47 | #include <QtCore/qstatemachine.h> | - |
48 | #include <private/qeventtransition_p.h> | - |
49 | | - |
50 | QT_BEGIN_NAMESPACE | - |
51 | | - |
52 | /*! | - |
53 | \class QKeyEventTransition | - |
54 | | - |
55 | \brief The QKeyEventTransition class provides a transition for key events. | - |
56 | | - |
57 | \since 4.6 | - |
58 | \ingroup statemachine | - |
59 | \inmodule QtWidgets | - |
60 | | - |
61 | QKeyEventTransition is part of \l{The State Machine Framework}. | - |
62 | | - |
63 | \sa QState::addTransition() | - |
64 | */ | - |
65 | | - |
66 | /*! | - |
67 | \property QKeyEventTransition::key | - |
68 | | - |
69 | \brief the key that this key event transition is associated with | - |
70 | */ | - |
71 | | - |
72 | /*! | - |
73 | \property QKeyEventTransition::modifierMask | - |
74 | | - |
75 | \brief the keyboard modifier mask that this key event transition checks for | - |
76 | */ | - |
77 | | - |
78 | class QKeyEventTransitionPrivate : public QEventTransitionPrivate | - |
79 | { | - |
80 | Q_DECLARE_PUBLIC(QKeyEventTransition) | - |
81 | public: | - |
82 | QKeyEventTransitionPrivate() {} | - |
83 | | - |
84 | QBasicKeyEventTransition *transition; | - |
85 | }; | - |
86 | | - |
87 | /*! | - |
88 | Constructs a new key event transition with the given \a sourceState. | - |
89 | */ | - |
90 | QKeyEventTransition::QKeyEventTransition(QState *sourceState) | - |
91 | : QEventTransition(*new QKeyEventTransitionPrivate, sourceState) | - |
92 | { | - |
93 | Q_D(QKeyEventTransition); executed (the execution status of this line is deduced): QKeyEventTransitionPrivate * const d = d_func(); | - |
94 | d->transition = new QBasicKeyEventTransition(); executed (the execution status of this line is deduced): d->transition = new QBasicKeyEventTransition(); | - |
95 | } executed: } Execution Count:1 | 1 |
96 | | - |
97 | /*! | - |
98 | Constructs a new key event transition for events of the given \a type for | - |
99 | the given \a object, with the given \a key and \a sourceState. | - |
100 | */ | - |
101 | QKeyEventTransition::QKeyEventTransition(QObject *object, QEvent::Type type, | - |
102 | int key, QState *sourceState) | - |
103 | : QEventTransition(*new QKeyEventTransitionPrivate, object, type, sourceState) | - |
104 | { | - |
105 | Q_D(QKeyEventTransition); executed (the execution status of this line is deduced): QKeyEventTransitionPrivate * const d = d_func(); | - |
106 | d->transition = new QBasicKeyEventTransition(type, key); executed (the execution status of this line is deduced): d->transition = new QBasicKeyEventTransition(type, key); | - |
107 | } executed: } Execution Count:1 | 1 |
108 | | - |
109 | /*! | - |
110 | Destroys this key event transition. | - |
111 | */ | - |
112 | QKeyEventTransition::~QKeyEventTransition() | - |
113 | { | - |
114 | Q_D(QKeyEventTransition); executed (the execution status of this line is deduced): QKeyEventTransitionPrivate * const d = d_func(); | - |
115 | delete d->transition; executed (the execution status of this line is deduced): delete d->transition; | - |
116 | } executed: } Execution Count:2 | 2 |
117 | | - |
118 | /*! | - |
119 | Returns the key that this key event transition checks for. | - |
120 | */ | - |
121 | int QKeyEventTransition::key() const | - |
122 | { | - |
123 | Q_D(const QKeyEventTransition); executed (the execution status of this line is deduced): const QKeyEventTransitionPrivate * const d = d_func(); | - |
124 | return d->transition->key(); executed: return d->transition->key(); Execution Count:2 | 2 |
125 | } | - |
126 | | - |
127 | /*! | - |
128 | Sets the key that this key event transition will check for. | - |
129 | */ | - |
130 | void QKeyEventTransition::setKey(int key) | - |
131 | { | - |
132 | Q_D(QKeyEventTransition); executed (the execution status of this line is deduced): QKeyEventTransitionPrivate * const d = d_func(); | - |
133 | d->transition->setKey(key); executed (the execution status of this line is deduced): d->transition->setKey(key); | - |
134 | } executed: } Execution Count:1 | 1 |
135 | | - |
136 | /*! | - |
137 | Returns the keyboard modifier mask that this key event transition checks | - |
138 | for. | - |
139 | */ | - |
140 | Qt::KeyboardModifiers QKeyEventTransition::modifierMask() const | - |
141 | { | - |
142 | Q_D(const QKeyEventTransition); never executed (the execution status of this line is deduced): const QKeyEventTransitionPrivate * const d = d_func(); | - |
143 | return d->transition->modifierMask(); never executed: return d->transition->modifierMask(); | 0 |
144 | } | - |
145 | | - |
146 | /*! | - |
147 | Sets the keyboard modifier mask that this key event transition will | - |
148 | check for to \a modifierMask. | - |
149 | */ | - |
150 | void QKeyEventTransition::setModifierMask(Qt::KeyboardModifiers modifierMask) | - |
151 | { | - |
152 | Q_D(QKeyEventTransition); never executed (the execution status of this line is deduced): QKeyEventTransitionPrivate * const d = d_func(); | - |
153 | d->transition->setModifierMask(modifierMask); never executed (the execution status of this line is deduced): d->transition->setModifierMask(modifierMask); | - |
154 | } | 0 |
155 | | - |
156 | /*! | - |
157 | \reimp | - |
158 | */ | - |
159 | bool QKeyEventTransition::eventTest(QEvent *event) | - |
160 | { | - |
161 | Q_D(const QKeyEventTransition); executed (the execution status of this line is deduced): const QKeyEventTransitionPrivate * const d = d_func(); | - |
162 | if (!QEventTransition::eventTest(event)) evaluated: !QEventTransition::eventTest(event) yes Evaluation Count:4 | yes Evaluation Count:2 |
| 2-4 |
163 | return false; executed: return false; Execution Count:4 | 4 |
164 | QStateMachine::WrappedEvent *we = static_cast<QStateMachine::WrappedEvent*>(event); executed (the execution status of this line is deduced): QStateMachine::WrappedEvent *we = static_cast<QStateMachine::WrappedEvent*>(event); | - |
165 | d->transition->setEventType(we->event()->type()); executed (the execution status of this line is deduced): d->transition->setEventType(we->event()->type()); | - |
166 | return QAbstractTransitionPrivate::get(d->transition)->callEventTest(we->event()); executed: return QAbstractTransitionPrivate::get(d->transition)->callEventTest(we->event()); Execution Count:2 | 2 |
167 | } | - |
168 | | - |
169 | /*! | - |
170 | \reimp | - |
171 | */ | - |
172 | void QKeyEventTransition::onTransition(QEvent *event) | - |
173 | { | - |
174 | QEventTransition::onTransition(event); executed (the execution status of this line is deduced): QEventTransition::onTransition(event); | - |
175 | } executed: } Execution Count:2 | 2 |
176 | | - |
177 | QT_END_NAMESPACE | - |
178 | | - |
179 | #endif //QT_NO_STATEMACHINE | - |
180 | | - |
| | |