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