statemachine/qmouseeventtransition.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtGui 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 Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/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 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qmouseeventtransition.h" -
43 -
44#ifndef QT_NO_STATEMACHINE -
45 -
46#include "qbasicmouseeventtransition_p.h" -
47#include <QtCore/qstatemachine.h> -
48#include <QtGui/qpainterpath.h> -
49#include <private/qeventtransition_p.h> -
50 -
51QT_BEGIN_NAMESPACE -
52 -
53/*! -
54 \class QMouseEventTransition -
55 -
56 \brief The QMouseEventTransition class provides a transition for mouse events. -
57 -
58 \since 4.6 -
59 \ingroup statemachine -
60 \inmodule QtWidgets -
61 -
62 QMouseEventTransition is part of \l{The State Machine Framework}. -
63 -
64 \sa QState::addTransition() -
65*/ -
66 -
67/*! -
68 \property QMouseEventTransition::button -
69 -
70 \brief the button that this mouse event transition is associated with -
71*/ -
72 -
73/*! -
74 \property QMouseEventTransition::modifierMask -
75 -
76 \brief the keyboard modifier mask that this mouse event transition checks for -
77*/ -
78 -
79class QMouseEventTransitionPrivate : public QEventTransitionPrivate -
80{ -
81 Q_DECLARE_PUBLIC(QMouseEventTransition) -
82public: -
83 QMouseEventTransitionPrivate(); -
84 -
85 QBasicMouseEventTransition *transition; -
86}; -
87 -
88QMouseEventTransitionPrivate::QMouseEventTransitionPrivate() -
89{ -
90} -
91 -
92/*! -
93 Constructs a new mouse event transition with the given \a sourceState. -
94*/ -
95QMouseEventTransition::QMouseEventTransition(QState *sourceState) -
96 : QEventTransition(*new QMouseEventTransitionPrivate, sourceState) -
97{ -
98 Q_D(QMouseEventTransition);
executed (the execution status of this line is deduced): QMouseEventTransitionPrivate * const d = d_func();
-
99 d->transition = new QBasicMouseEventTransition();
executed (the execution status of this line is deduced): d->transition = new QBasicMouseEventTransition();
-
100}
executed: }
Execution Count:1
1
101 -
102/*! -
103 Constructs a new mouse event transition for events of the given \a type for -
104 the given \a object, with the given \a button and \a sourceState. -
105*/ -
106QMouseEventTransition::QMouseEventTransition(QObject *object, QEvent::Type type, -
107 Qt::MouseButton button, -
108 QState *sourceState) -
109 : QEventTransition(*new QMouseEventTransitionPrivate, object, type, sourceState) -
110{ -
111 Q_D(QMouseEventTransition);
executed (the execution status of this line is deduced): QMouseEventTransitionPrivate * const d = d_func();
-
112 d->transition = new QBasicMouseEventTransition(type, button);
executed (the execution status of this line is deduced): d->transition = new QBasicMouseEventTransition(type, button);
-
113}
executed: }
Execution Count:1
1
114 -
115/*! -
116 Destroys this mouse event transition. -
117*/ -
118QMouseEventTransition::~QMouseEventTransition() -
119{ -
120 Q_D(QMouseEventTransition);
executed (the execution status of this line is deduced): QMouseEventTransitionPrivate * const d = d_func();
-
121 delete d->transition;
executed (the execution status of this line is deduced): delete d->transition;
-
122}
executed: }
Execution Count:2
2
123 -
124/*! -
125 Returns the button that this mouse event transition checks for. -
126*/ -
127Qt::MouseButton QMouseEventTransition::button() const -
128{ -
129 Q_D(const QMouseEventTransition);
executed (the execution status of this line is deduced): const QMouseEventTransitionPrivate * const d = d_func();
-
130 return d->transition->button();
executed: return d->transition->button();
Execution Count:2
2
131} -
132 -
133/*! -
134 Sets the \a button that this mouse event transition will check for. -
135*/ -
136void QMouseEventTransition::setButton(Qt::MouseButton button) -
137{ -
138 Q_D(QMouseEventTransition);
executed (the execution status of this line is deduced): QMouseEventTransitionPrivate * const d = d_func();
-
139 d->transition->setButton(button);
executed (the execution status of this line is deduced): d->transition->setButton(button);
-
140}
executed: }
Execution Count:1
1
141 -
142/*! -
143 Returns the keyboard modifier mask that this mouse event transition checks -
144 for. -
145*/ -
146Qt::KeyboardModifiers QMouseEventTransition::modifierMask() const -
147{ -
148 Q_D(const QMouseEventTransition);
never executed (the execution status of this line is deduced): const QMouseEventTransitionPrivate * const d = d_func();
-
149 return d->transition->modifierMask();
never executed: return d->transition->modifierMask();
0
150} -
151 -
152/*! -
153 Sets the keyboard modifier mask that this mouse event transition will -
154 check for to \a modifierMask. -
155*/ -
156void QMouseEventTransition::setModifierMask(Qt::KeyboardModifiers modifierMask) -
157{ -
158 Q_D(QMouseEventTransition);
never executed (the execution status of this line is deduced): QMouseEventTransitionPrivate * const d = d_func();
-
159 d->transition->setModifierMask(modifierMask);
never executed (the execution status of this line is deduced): d->transition->setModifierMask(modifierMask);
-
160}
never executed: }
0
161 -
162/*! -
163 Returns the hit test path for this mouse event transition. -
164*/ -
165QPainterPath QMouseEventTransition::hitTestPath() const -
166{ -
167 Q_D(const QMouseEventTransition);
never executed (the execution status of this line is deduced): const QMouseEventTransitionPrivate * const d = d_func();
-
168 return d->transition->hitTestPath();
never executed: return d->transition->hitTestPath();
0
169} -
170 -
171/*! -
172 Sets the hit test path for this mouse event transition to \a path. -
173 If a valid path has been set, the transition will only trigger if the mouse -
174 event position (QMouseEvent::pos()) is inside the path. -
175 -
176 \sa QPainterPath::contains() -
177*/ -
178void QMouseEventTransition::setHitTestPath(const QPainterPath &path) -
179{ -
180 Q_D(QMouseEventTransition);
never executed (the execution status of this line is deduced): QMouseEventTransitionPrivate * const d = d_func();
-
181 d->transition->setHitTestPath(path);
never executed (the execution status of this line is deduced): d->transition->setHitTestPath(path);
-
182}
never executed: }
0
183 -
184/*! -
185 \reimp -
186*/ -
187bool QMouseEventTransition::eventTest(QEvent *event) -
188{ -
189 Q_D(const QMouseEventTransition);
executed (the execution status of this line is deduced): const QMouseEventTransitionPrivate * const d = d_func();
-
190 if (!QEventTransition::eventTest(event))
evaluated: !QEventTransition::eventTest(event)
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:5
5-10
191 return false;
executed: return false;
Execution Count:10
10
192 QStateMachine::WrappedEvent *we = static_cast<QStateMachine::WrappedEvent*>(event);
executed (the execution status of this line is deduced): QStateMachine::WrappedEvent *we = static_cast<QStateMachine::WrappedEvent*>(event);
-
193 d->transition->setEventType(we->event()->type());
executed (the execution status of this line is deduced): d->transition->setEventType(we->event()->type());
-
194 return QAbstractTransitionPrivate::get(d->transition)->callEventTest(we->event());
executed: return QAbstractTransitionPrivate::get(d->transition)->callEventTest(we->event());
Execution Count:5
5
195} -
196 -
197/*! -
198 \reimp -
199*/ -
200void QMouseEventTransition::onTransition(QEvent *event) -
201{ -
202 QEventTransition::onTransition(event);
executed (the execution status of this line is deduced): QEventTransition::onTransition(event);
-
203}
executed: }
Execution Count:5
5
204 -
205QT_END_NAMESPACE -
206 -
207#endif //QT_NO_STATEMACHINE -
208 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial