summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qapplication_qpa.cpp
diff options
context:
space:
mode:
authorSergio Martins <sergio.martins.qnx@kdab.com>2012-10-10 21:24:23 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-12 02:19:36 +0200
commitee447020dbecef821b73d7d2981d7c8859c9a28b (patch)
treebe8bb4d30a4fb2b6714f82859da2790c9796ca12 /src/gui/kernel/qapplication_qpa.cpp
parent6727781ec9a4657a6a8e0ad27687c78ee90c6989 (diff)
Introducing the PlatformPanel event type.
This event can be used by any platform plugin to implement special application panels/overlayed menus. Currently used by QNX only. This replaces sending fake Qt::Key_Menu presses in the QNX plugin. Qt::Key_Menu is already used when invoking context menus with the keyboard. ( backport of qtbase/9695df4d44b228e7e778ff17d5cccac30967b1fd ) Change-Id: Id5cf96758f1104f454a2bb977b367d09d4685b62 Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com> Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
Diffstat (limited to 'src/gui/kernel/qapplication_qpa.cpp')
-rw-r--r--src/gui/kernel/qapplication_qpa.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp
index aed539e6d1..011d81bcde 100644
--- a/src/gui/kernel/qapplication_qpa.cpp
+++ b/src/gui/kernel/qapplication_qpa.cpp
@@ -137,6 +137,10 @@ void QApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate
case QWindowSystemInterfacePrivate::LocaleChange:
QApplicationPrivate::reportLocaleChange();
break;
+ case QWindowSystemInterfacePrivate::PlatformPanel:
+ QApplicationPrivate::processPlatformPanelEvent(
+ static_cast<QWindowSystemInterfacePrivate::PlatformPanelEvent *>(e));
+ break;
default:
qWarning() << "Unknown user input event type:" << e->type;
break;
@@ -185,6 +189,7 @@ static bool qt_try_modal(QWidget *widget, QEvent::Type type)
case QEvent::MouseMove:
case QEvent::KeyPress:
case QEvent::KeyRelease:
+ case QEvent::PlatformPanel:
block_event = true;
break;
default:
@@ -777,6 +782,19 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mouse
#endif // QT_NO_CONTEXTMENU
}
+void QApplicationPrivate::processPlatformPanelEvent(QWindowSystemInterfacePrivate::PlatformPanelEvent *e)
+{
+ if (!e->widget)
+ return;
+
+ if (app_do_modal && !qt_try_modal(e->widget.data(), QEvent::PlatformPanel)) {
+ // a modal window is blocking this window, don't allow events through
+ return;
+ }
+
+ QEvent ev(QEvent::PlatformPanel);
+ QApplication::sendSpontaneousEvent(e->widget.data(), &ev);
+}
//### there's a lot of duplicated logic here -- refactoring required!