OpenCoverage

qbasicmouseeventtransition.cpp

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

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