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

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