summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/kernel/qguiapplication.cpp15
-rw-r--r--src/gui/kernel/qguiapplication_p.h2
-rw-r--r--src/gui/kernel/qplatformwindow_qpa.cpp12
-rw-r--r--src/gui/kernel/qplatformwindow_qpa.h2
-rw-r--r--src/widgets/kernel/qapplication.cpp2
5 files changed, 33 insertions, 0 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 0eb53df443..2c2d833209 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1032,6 +1032,7 @@ bool QGuiApplication::notify(QObject *object, QEvent *event)
}
#endif
+ QGuiApplicationPrivate::sendQWindowEventToQPlatformWindow(qobject_cast<QWindow *>(object), event);
return QCoreApplication::notify(object, event);
}
@@ -1053,6 +1054,20 @@ bool QGuiApplication::compressEvent(QEvent *event, QObject *receiver, QPostEvent
return QCoreApplication::compressEvent(event, receiver, postedEvents);
}
+void QGuiApplicationPrivate::sendQWindowEventToQPlatformWindow(QWindow *window, QEvent *event)
+{
+ if (!window)
+ return;
+ QPlatformWindow *platformWindow = window->handle();
+ if (!platformWindow)
+ return;
+ // spontaneous events come from the platform integration already, we don't need to send the events back
+ if (event->spontaneous())
+ return;
+ // let the platform window do any handling it needs to as well
+ platformWindow->windowEvent(event);
+}
+
bool QGuiApplicationPrivate::processNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result)
{
return window->nativeEvent(eventType, message, result);
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index c0cee51832..35bf8570ea 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -129,6 +129,8 @@ public:
static bool processNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result);
+ static void sendQWindowEventToQPlatformWindow(QWindow *window, QEvent *event);
+
static inline Qt::Alignment visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment)
{
if (!(alignment & Qt::AlignHorizontal_Mask))
diff --git a/src/gui/kernel/qplatformwindow_qpa.cpp b/src/gui/kernel/qplatformwindow_qpa.cpp
index d5f0277ccd..b36a2771f3 100644
--- a/src/gui/kernel/qplatformwindow_qpa.cpp
+++ b/src/gui/kernel/qplatformwindow_qpa.cpp
@@ -311,6 +311,18 @@ bool QPlatformWindow::setMouseGrabEnabled(bool grab)
}
/*!
+ Reimplement this method to be able to do any platform specific event
+ handling. All events for window() are passed to this function before being
+ sent to QWindow::event().
+
+ The default implementation is empty and does nothing with \a event.
+*/
+void QPlatformWindow::windowEvent(QEvent *event)
+{
+ Q_UNUSED(event);
+}
+
+/*!
\class QPlatformWindow
\since 4.8
\internal
diff --git a/src/gui/kernel/qplatformwindow_qpa.h b/src/gui/kernel/qplatformwindow_qpa.h
index a2b6bcb508..31b14ca97d 100644
--- a/src/gui/kernel/qplatformwindow_qpa.h
+++ b/src/gui/kernel/qplatformwindow_qpa.h
@@ -113,6 +113,8 @@ public:
virtual bool setKeyboardGrabEnabled(bool grab);
virtual bool setMouseGrabEnabled(bool grab);
+ virtual void windowEvent(QEvent *event);
+
protected:
QScopedPointer<QPlatformWindowPrivate> d_ptr;
private:
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index c560dba1b7..e82f5c1531 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -2992,6 +2992,8 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
d->checkReceiverThread(receiver);
#endif
+ QGuiApplicationPrivate::sendQWindowEventToQPlatformWindow(qobject_cast<QWindow *>(receiver), e);
+
// capture the current mouse/keyboard state
if(e->spontaneous()) {
if (e->type() == QEvent::MouseButtonPress