summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qcoreapplication.cpp
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-05-16 18:46:50 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-05-20 12:26:28 +0000
commitda8ace713a19d2a8c9831ddf50d17607bc4856cc (patch)
tree2e48cee43e46de9ffad45f9b614529410cd35f42 /src/corelib/kernel/qcoreapplication.cpp
parentf78ef9753c58587a5db292493b2c003a3e0a3144 (diff)
QWidgetWindow: Forward incoming events with their original spontaneous state
The events may come from QPA, as spontaneous events, or from other parts of Qt, as non-spontaneous events. We should keep the state of the original event. Introduces QCoreApplication::forwardEvent() as a wrapper around the opaquely named notifyInternal2. Ideally this would be the behavior of sendEvent, with an enum argument to override the flag, but that ship has sailed. Change-Id: Ib0209f2b99744bd10590c63239ee7a97b60be4fd Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/kernel/qcoreapplication.cpp')
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 39e7c71a9c..a5bd2513b6 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -1019,6 +1019,21 @@ bool QCoreApplication::notifyInternal2(QObject *receiver, QEvent *event)
}
/*!
+ \internal
+ \since 5.10
+
+ Forwards the \a event to the \a receiver, using the spontaneous
+ state of the \a originatingEvent if specified.
+*/
+bool QCoreApplication::forwardEvent(QObject *receiver, QEvent *event, QEvent *originatingEvent)
+{
+ if (event && originatingEvent)
+ event->spont = originatingEvent->spont;
+
+ return notifyInternal2(receiver, event);
+}
+
+/*!
Sends \a event to \a receiver: \a {receiver}->event(\a event).
Returns the value that is returned from the receiver's event
handler. Note that this function is called for all events sent to