diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h index d784267a65122ee9a0f6551cb543abc9105a7f4b..f0c9e4e1c2b99d88bc7fd48bed2a8253efa88c53 100644 --- a/src/corelib/kernel/qcoreapplication_p.h +++ b/src/corelib/kernel/qcoreapplication_p.h @@ -96,6 +96,7 @@ public: bool sendThroughApplicationEventFilters(QObject *, QEvent *); bool sendThroughObjectEventFilters(QObject *, QEvent *); bool notify_helper(QObject *, QEvent *); + static inline void setEventSpontaneous(QEvent *e, bool spontaneous) { e->spont = spontaneous; } virtual void createEventDispatcher(); virtual void eventDispatcherReady(); diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h index a498afbb04d82e925e35b581cb1c70e803cf6271..cd7689f842f231ef9603b342d783dc8cd48b3c42 100644 --- a/src/corelib/kernel/qcoreevent.h +++ b/src/corelib/kernel/qcoreevent.h @@ -318,16 +318,10 @@ private: friend class QCoreApplicationPrivate; friend class QThreadData; friend class QApplication; - friend class QApplicationPrivate; friend class QShortcutMap; friend class QGraphicsView; - friend class QGraphicsViewPrivate; friend class QGraphicsScene; friend class QGraphicsScenePrivate; - friend class QWidgetWindow; -#ifndef QT_NO_GESTURES - friend class QGestureManager; -#endif }; class Q_CORE_EXPORT QTimerEvent : public QEvent diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 9c2c2bab162eeb50cc72bc811ac57cda9fc4186b..703b748a562b55a8e9aa2e74e6e82b1254953e35 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3505,7 +3505,7 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e) // deliver the event bool consumed = receiver->event(e); - e->spont = false; + QCoreApplicationPrivate::setEventSpontaneous(e, false); return consumed; } diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index fc328e7af0f6588c0bf3591b8446aba19bd347d5..06a4d8c960ef75f8db3d7174545034de08f203a3 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -443,7 +443,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event) // Use postEvent() to ensure the local QEventLoop terminates when called from QMenu::exec() const QPoint localPos = win->mapFromGlobal(event->globalPos()); QMouseEvent *e = new QMouseEvent(QEvent::MouseButtonPress, localPos, localPos, event->globalPos(), event->button(), event->buttons(), event->modifiers()); - e->spont = 1; + QCoreApplicationPrivate::setEventSpontaneous(e, true); QGuiApplicationPrivate::setMouseEventSource(e, QGuiApplicationPrivate::mouseEventSource(event)); e->setTimestamp(event->timestamp()); QCoreApplication::postEvent(win, e);