diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2011-06-29 10:16:34 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-06-30 11:33:27 +0200 |
commit | 13b83d896de8b00d6a373c97917ce52553a7e451 (patch) | |
tree | 708bb5f0f37035fc2e7b65f424ce76a4469b7b46 /src | |
parent | 06d85c51fe062b3ae9431860aa9dedc860bf4681 (diff) |
make QHoverEvent inherit from QInputEvent
QHoverEvent is an input event and as such should
also contain the current keyboard modifiers.
Change-Id: Ic403a8511eb991a9c6b5132908af1d5900869361
Reviewed-on: http://codereview.qt.nokia.com/937
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qapplication.cpp | 8 | ||||
-rw-r--r-- | src/gui/kernel/qevent.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qevent.h | 4 |
3 files changed, 9 insertions, 7 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 361ec6ddec..760fe789de 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -2794,7 +2794,8 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) { if (w->testAttribute(Qt::WA_Hover) && (!QApplication::activePopupWidget() || QApplication::activePopupWidget() == w->window())) { Q_ASSERT(instance()); - QHoverEvent he(QEvent::HoverLeave, QPoint(-1, -1), w->mapFromGlobal(QApplicationPrivate::instance()->hoverGlobalPos)); + QHoverEvent he(QEvent::HoverLeave, QPoint(-1, -1), w->mapFromGlobal(QApplicationPrivate::instance()->hoverGlobalPos), + QApplication::keyboardModifiers()); qApp->d_func()->notify_helper(w, &he); } } @@ -2807,7 +2808,8 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) { QApplication::sendEvent(w, &enterEvent); if (w->testAttribute(Qt::WA_Hover) && (!QApplication::activePopupWidget() || QApplication::activePopupWidget() == w->window())) { - QHoverEvent he(QEvent::HoverEnter, w->mapFromGlobal(posEnter), QPoint(-1, -1)); + QHoverEvent he(QEvent::HoverEnter, w->mapFromGlobal(posEnter), QPoint(-1, -1), + QApplication::keyboardModifiers()); qApp->d_func()->notify_helper(w, &he); } } @@ -4059,7 +4061,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) while (w) { if (w->testAttribute(Qt::WA_Hover) && (!QApplication::activePopupWidget() || QApplication::activePopupWidget() == w->window())) { - QHoverEvent he(QEvent::HoverMove, relpos, relpos - diff); + QHoverEvent he(QEvent::HoverMove, relpos, relpos - diff, mouse->modifiers()); d->notify_helper(w, &he); } if (w->isWindow() || w->testAttribute(Qt::WA_NoMousePropagation)) diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index aba848258b..946ab33e80 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -445,8 +445,8 @@ QMouseEvent::QMouseEvent(Type type, const QPointF &pos, const QPointF &globalPos receiving widget, while \a oldPos is the previous mouse cursor's position relative to the receiving widget. */ -QHoverEvent::QHoverEvent(Type type, const QPointF &pos, const QPointF &oldPos) - : QEvent(type), p(pos), op(oldPos) +QHoverEvent::QHoverEvent(Type type, const QPointF &pos, const QPointF &oldPos, Qt::KeyboardModifiers modifiers) + : QInputEvent(type, modifiers), p(pos), op(oldPos) { } diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 6ec9f1b9bf..0847fd6046 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -119,10 +119,10 @@ protected: Qt::MouseButtons mouseState; }; -class Q_GUI_EXPORT QHoverEvent : public QEvent +class Q_GUI_EXPORT QHoverEvent : public QInputEvent { public: - QHoverEvent(Type type, const QPointF &pos, const QPointF &oldPos); + QHoverEvent(Type type, const QPointF &pos, const QPointF &oldPos, Qt::KeyboardModifiers modifiers = Qt::NoModifier); ~QHoverEvent(); inline QPoint pos() const { return p.toPoint(); } |