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>
This commit is contained in:
parent
06d85c51fe
commit
13b83d896d
@ -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))
|
||||
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -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(); }
|
||||
|
Loading…
Reference in New Issue
Block a user