OpenCoverage

qmouseeventtransition.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/statemachine/qmouseeventtransition.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 "qmouseeventtransition.h"-
41-
42#ifndef QT_NO_STATEMACHINE-
43-
44#include "qbasicmouseeventtransition_p.h"-
45#include <QtCore/qstatemachine.h>-
46#include <QtGui/qpainterpath.h>-
47#include <private/qeventtransition_p.h>-
48-
49QT_BEGIN_NAMESPACE-
50-
51/*!-
52 \class QMouseEventTransition-
53-
54 \brief The QMouseEventTransition class provides a transition for mouse events.-
55-
56 \since 4.6-
57 \ingroup statemachine-
58 \inmodule QtWidgets-
59-
60 QMouseEventTransition is part of \l{The State Machine Framework}.-
61-
62 \sa QState::addTransition()-
63*/-
64-
65/*!-
66 \property QMouseEventTransition::button-
67-
68 \brief the button that this mouse event transition is associated with-
69*/-
70-
71/*!-
72 \property QMouseEventTransition::modifierMask-
73-
74 \brief the keyboard modifier mask that this mouse event transition checks for-
75*/-
76-
77class QMouseEventTransitionPrivate : public QEventTransitionPrivate-
78{-
79 Q_DECLARE_PUBLIC(QMouseEventTransition)-
80public:-
81 QMouseEventTransitionPrivate();-
82-
83 QBasicMouseEventTransition *transition;-
84};-
85-
86QMouseEventTransitionPrivate::QMouseEventTransitionPrivate()-
87{-
88}-
89-
90/*!-
91 Constructs a new mouse event transition with the given \a sourceState.-
92*/-
93QMouseEventTransition::QMouseEventTransition(QState *sourceState)-
94 : QEventTransition(*new QMouseEventTransitionPrivate, sourceState)-
95{-
96 Q_D(QMouseEventTransition);-
97 d->transition = new QBasicMouseEventTransition();-
98}
never executed: end of block
0
99-
100/*!-
101 Constructs a new mouse event transition for events of the given \a type for-
102 the given \a object, with the given \a button and \a sourceState.-
103*/-
104QMouseEventTransition::QMouseEventTransition(QObject *object, QEvent::Type type,-
105 Qt::MouseButton button,-
106 QState *sourceState)-
107 : QEventTransition(*new QMouseEventTransitionPrivate, object, type, sourceState)-
108{-
109 Q_D(QMouseEventTransition);-
110 d->transition = new QBasicMouseEventTransition(type, button);-
111}
never executed: end of block
0
112-
113/*!-
114 Destroys this mouse event transition.-
115*/-
116QMouseEventTransition::~QMouseEventTransition()-
117{-
118 Q_D(QMouseEventTransition);-
119 delete d->transition;-
120}
never executed: end of block
0
121-
122/*!-
123 Returns the button that this mouse event transition checks for.-
124*/-
125Qt::MouseButton QMouseEventTransition::button() const-
126{-
127 Q_D(const QMouseEventTransition);-
128 return d->transition->button();
never executed: return d->transition->button();
0
129}-
130-
131/*!-
132 Sets the \a button that this mouse event transition will check for.-
133*/-
134void QMouseEventTransition::setButton(Qt::MouseButton button)-
135{-
136 Q_D(QMouseEventTransition);-
137 d->transition->setButton(button);-
138}
never executed: end of block
0
139-
140/*!-
141 Returns the keyboard modifier mask that this mouse event transition checks-
142 for.-
143*/-
144Qt::KeyboardModifiers QMouseEventTransition::modifierMask() const-
145{-
146 Q_D(const QMouseEventTransition);-
147 return d->transition->modifierMask();
never executed: return d->transition->modifierMask();
0
148}-
149-
150/*!-
151 Sets the keyboard modifier mask that this mouse event transition will-
152 check for to \a modifierMask.-
153*/-
154void QMouseEventTransition::setModifierMask(Qt::KeyboardModifiers modifierMask)-
155{-
156 Q_D(QMouseEventTransition);-
157 d->transition->setModifierMask(modifierMask);-
158}
never executed: end of block
0
159-
160/*!-
161 Returns the hit test path for this mouse event transition.-
162*/-
163QPainterPath QMouseEventTransition::hitTestPath() const-
164{-
165 Q_D(const QMouseEventTransition);-
166 return d->transition->hitTestPath();
never executed: return d->transition->hitTestPath();
0
167}-
168-
169/*!-
170 Sets the hit test path for this mouse event transition to \a path.-
171 If a valid path has been set, the transition will only trigger if the mouse-
172 event position (QMouseEvent::pos()) is inside the path.-
173-
174 \sa QPainterPath::contains()-
175*/-
176void QMouseEventTransition::setHitTestPath(const QPainterPath &path)-
177{-
178 Q_D(QMouseEventTransition);-
179 d->transition->setHitTestPath(path);-
180}
never executed: end of block
0
181-
182/*!-
183 \reimp-
184*/-
185bool QMouseEventTransition::eventTest(QEvent *event)-
186{-
187 Q_D(const QMouseEventTransition);-
188 if (!QEventTransition::eventTest(event))
!QEventTransit...entTest(event)Description
TRUEnever evaluated
FALSEnever evaluated
0
189 return false;
never executed: return false;
0
190 QStateMachine::WrappedEvent *we = static_cast<QStateMachine::WrappedEvent*>(event);-
191 d->transition->setEventType(we->event()->type());-
192 return QAbstractTransitionPrivate::get(d->transition)->callEventTest(we->event());
never executed: return QAbstractTransitionPrivate::get(d->transition)->callEventTest(we->event());
0
193}-
194-
195/*!-
196 \reimp-
197*/-
198void QMouseEventTransition::onTransition(QEvent *event)-
199{-
200 QEventTransition::onTransition(event);-
201}
never executed: end of block
0
202-
203QT_END_NAMESPACE-
204-
205#include "moc_qmouseeventtransition.cpp"-
206-
207#endif //QT_NO_STATEMACHINE-
Source codeSwitch to Preprocessed file

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