67 |
67 |
68 static QBasicMouseEventTransitionPrivate *get(QBasicMouseEventTransition *q); |
68 static QBasicMouseEventTransitionPrivate *get(QBasicMouseEventTransition *q); |
69 |
69 |
70 QEvent::Type eventType; |
70 QEvent::Type eventType; |
71 Qt::MouseButton button; |
71 Qt::MouseButton button; |
72 Qt::KeyboardModifiers modifiersMask; |
72 Qt::KeyboardModifiers modifierMask; |
73 QPainterPath path; |
73 QPainterPath path; |
74 }; |
74 }; |
75 |
75 |
76 QBasicMouseEventTransitionPrivate::QBasicMouseEventTransitionPrivate() |
76 QBasicMouseEventTransitionPrivate::QBasicMouseEventTransitionPrivate() |
77 { |
77 { |
147 Q_D(QBasicMouseEventTransition); |
147 Q_D(QBasicMouseEventTransition); |
148 d->button = button; |
148 d->button = button; |
149 } |
149 } |
150 |
150 |
151 /*! |
151 /*! |
152 Returns the keyboard modifiers mask that this mouse event transition checks |
152 Returns the keyboard modifier mask that this mouse event transition checks |
153 for. |
153 for. |
154 */ |
154 */ |
155 Qt::KeyboardModifiers QBasicMouseEventTransition::modifiersMask() const |
155 Qt::KeyboardModifiers QBasicMouseEventTransition::modifierMask() const |
156 { |
156 { |
157 Q_D(const QBasicMouseEventTransition); |
157 Q_D(const QBasicMouseEventTransition); |
158 return d->modifiersMask; |
158 return d->modifierMask; |
159 } |
159 } |
160 |
160 |
161 /*! |
161 /*! |
162 Sets the keyboard modifiers mask that this mouse event transition will check |
162 Sets the keyboard modifier mask that this mouse event transition will check |
163 for. |
163 for. |
164 */ |
164 */ |
165 void QBasicMouseEventTransition::setModifiersMask(Qt::KeyboardModifiers modifiersMask) |
165 void QBasicMouseEventTransition::setModifierMask(Qt::KeyboardModifiers modifierMask) |
166 { |
166 { |
167 Q_D(QBasicMouseEventTransition); |
167 Q_D(QBasicMouseEventTransition); |
168 d->modifiersMask = modifiersMask; |
168 d->modifierMask = modifierMask; |
169 } |
169 } |
170 |
170 |
171 /*! |
171 /*! |
172 Returns the path for this mouse event transition. |
172 Returns the hit test path for this mouse event transition. |
173 */ |
173 */ |
174 QPainterPath QBasicMouseEventTransition::path() const |
174 QPainterPath QBasicMouseEventTransition::hitTestPath() const |
175 { |
175 { |
176 Q_D(const QBasicMouseEventTransition); |
176 Q_D(const QBasicMouseEventTransition); |
177 return d->path; |
177 return d->path; |
178 } |
178 } |
179 |
179 |
180 /*! |
180 /*! |
181 Sets the path for this mouse event transition. |
181 Sets the hit test path for this mouse event transition. |
182 */ |
182 */ |
183 void QBasicMouseEventTransition::setPath(const QPainterPath &path) |
183 void QBasicMouseEventTransition::setHitTestPath(const QPainterPath &path) |
184 { |
184 { |
185 Q_D(QBasicMouseEventTransition); |
185 Q_D(QBasicMouseEventTransition); |
186 d->path = path; |
186 d->path = path; |
187 } |
187 } |
188 |
188 |
193 { |
193 { |
194 Q_D(const QBasicMouseEventTransition); |
194 Q_D(const QBasicMouseEventTransition); |
195 if (event->type() == d->eventType) { |
195 if (event->type() == d->eventType) { |
196 QMouseEvent *me = static_cast<QMouseEvent*>(event); |
196 QMouseEvent *me = static_cast<QMouseEvent*>(event); |
197 return (me->button() == d->button) |
197 return (me->button() == d->button) |
198 && ((me->modifiers() & d->modifiersMask) == d->modifiersMask) |
198 && ((me->modifiers() & d->modifierMask) == d->modifierMask) |
199 && (d->path.isEmpty() || d->path.contains(me->pos())); |
199 && (d->path.isEmpty() || d->path.contains(me->pos())); |
200 } |
200 } |
201 return false; |
201 return false; |
202 } |
202 } |
203 |
203 |