qbasickeyeventtransition.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/statemachine/qbasickeyeventtransition.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtWidgets 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 The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/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 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qbasickeyeventtransition_p.h"-
41-
42#ifndef QT_NO_STATEMACHINE-
43-
44#include <QtGui/qevent.h>-
45#include <qdebug.h>-
46#include <private/qabstracttransition_p.h>-
47-
48QT_BEGIN_NAMESPACE-
49-
50/*!-
51 \internal-
52 \class QBasicKeyEventTransition-
53 \since 4.6-
54 \ingroup statemachine-
55-
56 \brief The QBasicKeyEventTransition class provides a transition for Qt key events.-
57*/-
58-
59class QBasicKeyEventTransitionPrivate : public QAbstractTransitionPrivate-
60{-
61 Q_DECLARE_PUBLIC(QBasicKeyEventTransition)-
62public:-
63 QBasicKeyEventTransitionPrivate();-
64-
65 static QBasicKeyEventTransitionPrivate *get(QBasicKeyEventTransition *q);-
66-
67 QEvent::Type eventType;-
68 int key;-
69 Qt::KeyboardModifiers modifierMask;-
70};-
71-
72QBasicKeyEventTransitionPrivate::QBasicKeyEventTransitionPrivate()-
73{-
74 eventType = QEvent::None;-
75 key = 0;-
76 modifierMask = Qt::NoModifier;-
77}
never executed: end of block
0
78-
79QBasicKeyEventTransitionPrivate *QBasicKeyEventTransitionPrivate::get(QBasicKeyEventTransition *q)-
80{-
81 return q->d_func();
never executed: return q->d_func();
0
82}-
83-
84/*!-
85 Constructs a new key event transition with the given \a sourceState.-
86*/-
87QBasicKeyEventTransition::QBasicKeyEventTransition(QState *sourceState)-
88 : QAbstractTransition(*new QBasicKeyEventTransitionPrivate, sourceState)-
89{-
90}
never executed: end of block
0
91-
92/*!-
93 Constructs a new event transition for events of the given \a type for the-
94 given \a key, with the given \a sourceState.-
95*/-
96QBasicKeyEventTransition::QBasicKeyEventTransition(QEvent::Type type, int key,-
97 QState *sourceState)-
98 : QAbstractTransition(*new QBasicKeyEventTransitionPrivate, sourceState)-
99{-
100 Q_D(QBasicKeyEventTransition);-
101 d->eventType = type;-
102 d->key = key;-
103}
never executed: end of block
0
104-
105/*!-
106 Constructs a new event transition for events of the given \a type for the-
107 given \a key, with the given \a modifierMask and \a sourceState.-
108*/-
109QBasicKeyEventTransition::QBasicKeyEventTransition(QEvent::Type type, int key,-
110 Qt::KeyboardModifiers modifierMask,-
111 QState *sourceState)-
112 : QAbstractTransition(*new QBasicKeyEventTransitionPrivate, sourceState)-
113{-
114 Q_D(QBasicKeyEventTransition);-
115 d->eventType = type;-
116 d->key = key;-
117 d->modifierMask = modifierMask;-
118}
never executed: end of block
0
119-
120/*!-
121 Destroys this event transition.-
122*/-
123QBasicKeyEventTransition::~QBasicKeyEventTransition()-
124{-
125}-
126-
127/*!-
128 Returns the event type that this key event transition is associated with.-
129*/-
130QEvent::Type QBasicKeyEventTransition::eventType() const-
131{-
132 Q_D(const QBasicKeyEventTransition);-
133 return d->eventType;
never executed: return d->eventType;
0
134}-
135-
136/*!-
137 Sets the event \a type that this key event transition is associated with.-
138*/-
139void QBasicKeyEventTransition::setEventType(QEvent::Type type)-
140{-
141 Q_D(QBasicKeyEventTransition);-
142 d->eventType = type;-
143}
never executed: end of block
0
144-
145/*!-
146 Returns the key that this key event transition checks for.-
147*/-
148int QBasicKeyEventTransition::key() const-
149{-
150 Q_D(const QBasicKeyEventTransition);-
151 return d->key;
never executed: return d->key;
0
152}-
153-
154/*!-
155 Sets the key that this key event transition will check for.-
156*/-
157void QBasicKeyEventTransition::setKey(int key)-
158{-
159 Q_D(QBasicKeyEventTransition);-
160 d->key = key;-
161}
never executed: end of block
0
162-
163/*!-
164 Returns the keyboard modifier mask that this key event transition checks-
165 for.-
166*/-
167Qt::KeyboardModifiers QBasicKeyEventTransition::modifierMask() const-
168{-
169 Q_D(const QBasicKeyEventTransition);-
170 return d->modifierMask;
never executed: return d->modifierMask;
0
171}-
172-
173/*!-
174 Sets the keyboard modifier mask that this key event transition will check-
175 for.-
176*/-
177void QBasicKeyEventTransition::setModifierMask(Qt::KeyboardModifiers modifierMask)-
178{-
179 Q_D(QBasicKeyEventTransition);-
180 d->modifierMask = modifierMask;-
181}
never executed: end of block
0
182-
183/*!-
184 \reimp-
185*/-
186bool QBasicKeyEventTransition::eventTest(QEvent *event)-
187{-
188 Q_D(const QBasicKeyEventTransition);-
189 if (event->type() == d->eventType) {
event->type() == d->eventTypeDescription
TRUEnever evaluated
FALSEnever evaluated
0
190 QKeyEvent *ke = static_cast<QKeyEvent*>(event);-
191 return (ke->key() == d->key)
never executed: return (ke->key() == d->key) && ((ke->modifiers() & d->modifierMask) == d->modifierMask);
0
192 && ((ke->modifiers() & d->modifierMask) == d->modifierMask);
never executed: return (ke->key() == d->key) && ((ke->modifiers() & d->modifierMask) == d->modifierMask);
0
193 }-
194 return false;
never executed: return false;
0
195}-
196-
197/*!-
198 \reimp-
199*/-
200void QBasicKeyEventTransition::onTransition(QEvent *)-
201{-
202}-
203-
204QT_END_NAMESPACE-
205-
206#include "moc_qbasickeyeventtransition_p.cpp"-
207-
208#endif //QT_NO_STATEMACHINE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9