summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSergio Martins <sergio.martins.qnx@kdab.com>2012-10-10 20:24:23 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-12 00:19:36 (GMT)
commitee447020dbecef821b73d7d2981d7c8859c9a28b (patch)
treebe8bb4d30a4fb2b6714f82859da2790c9796ca12 /src
parent6727781ec9a4657a6a8e0ad27687c78ee90c6989 (diff)
downloadQt-ee447020dbecef821b73d7d2981d7c8859c9a28b.zip
Qt-ee447020dbecef821b73d7d2981d7c8859c9a28b.tar.gz
Qt-ee447020dbecef821b73d7d2981d7c8859c9a28b.tar.bz2
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')
-rw-r--r--src/corelib/kernel/qcoreevent.cpp1
-rw-r--r--src/corelib/kernel/qcoreevent.h3
-rw-r--r--src/gui/kernel/qapplication_p.h1
-rw-r--r--src/gui/kernel/qapplication_qpa.cpp18
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.cpp6
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.h2
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa_p.h9
-rw-r--r--src/plugins/platforms/blackberry/qbbnavigatoreventhandler.cpp6
8 files changed, 41 insertions, 5 deletions
diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp
index 95a53cb..40ed300 100644
--- a/src/corelib/kernel/qcoreevent.cpp
+++ b/src/corelib/kernel/qcoreevent.cpp
@@ -183,6 +183,7 @@ QT_BEGIN_NAMESPACE
\value PaletteChange Palette of the widget changed.
\value ParentAboutToChange The widget parent is about to change.
\value ParentChange The widget parent has changed.
+ \value PlatformPanel A platform specific panel has been requested.
\value Polish The widget is polished.
\value PolishRequest The widget should be polished.
\value QueryWhatsThis The widget should accept the event if it has "What's This?" help.
diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h
index 36cb383..f67daf6 100644
--- a/src/corelib/kernel/qcoreevent.h
+++ b/src/corelib/kernel/qcoreevent.h
@@ -288,6 +288,9 @@ public:
Gesture = 198,
GestureOverride = 202,
#endif
+
+ PlatformPanel = 212,
+
// 512 reserved for Qt Jambi's MetaCall event
// 513 reserved for Qt Jambi's DeleteOnMainThread event
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h
index 422e6de..e270a32 100644
--- a/src/gui/kernel/qapplication_p.h
+++ b/src/gui/kernel/qapplication_p.h
@@ -487,6 +487,7 @@ public:
static void processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent *e);
static void processWheelEvent(QWindowSystemInterfacePrivate::WheelEvent *e);
static void processTouchEvent(QWindowSystemInterfacePrivate::TouchEvent *e);
+ static void processPlatformPanelEvent(QWindowSystemInterfacePrivate::PlatformPanelEvent *e);
static void processCloseEvent(QWindowSystemInterfacePrivate::CloseEvent *e);
diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp
index aed539e..011d81b 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!
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
index 25c01ca..891ae6e 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
@@ -298,5 +298,11 @@ void QWindowSystemInterface::handleLocaleChange()
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
+void QWindowSystemInterface::handlePlatformPanelEvent(QWidget *w)
+{
+ QWindowSystemInterfacePrivate::PlatformPanelEvent *e =
+ new QWindowSystemInterfacePrivate::PlatformPanelEvent(w);
+ QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
+}
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h
index efd0681..26fce4f9 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.h
@@ -102,6 +102,8 @@ public:
static void handleScreenCountChange(int count);
static void handleLocaleChange();
+
+ static void handlePlatformPanelEvent(QWidget *w);
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
index 1e763e3..cd59ad6 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
@@ -62,7 +62,8 @@ public:
ScreenGeometry,
ScreenAvailableGeometry,
ScreenCountChange,
- LocaleChange
+ LocaleChange,
+ PlatformPanel
};
class WindowSystemEvent {
@@ -200,6 +201,12 @@ public:
: WindowSystemEvent(LocaleChange) { }
};
+ class PlatformPanelEvent : public WindowSystemEvent {
+ public:
+ explicit PlatformPanelEvent(QWidget *w)
+ : WindowSystemEvent(PlatformPanel), widget(w) { }
+ QWeakPointer<QWidget> widget;
+ };
static QList<WindowSystemEvent *> windowSystemEventQueue;
static QMutex queueMutex;
diff --git a/src/plugins/platforms/blackberry/qbbnavigatoreventhandler.cpp b/src/plugins/platforms/blackberry/qbbnavigatoreventhandler.cpp
index b253257..0f19904 100644
--- a/src/plugins/platforms/blackberry/qbbnavigatoreventhandler.cpp
+++ b/src/plugins/platforms/blackberry/qbbnavigatoreventhandler.cpp
@@ -80,14 +80,12 @@ void QBBNavigatorEventHandler::handleOrientationChange(int angle)
void QBBNavigatorEventHandler::handleSwipeDown()
{
- // simulate menu key press
#if defined(QBBNAVIGATOREVENTHANDLER_DEBUG)
qDebug() << Q_FUNC_INFO;
#endif
-
QWidget *w = QApplication::activeWindow();
- QWindowSystemInterface::handleKeyEvent(w, QEvent::KeyPress, Qt::Key_Menu, Qt::NoModifier);
- QWindowSystemInterface::handleKeyEvent(w, QEvent::KeyRelease, Qt::Key_Menu, Qt::NoModifier);
+ if (w)
+ QWindowSystemInterface::handlePlatformPanelEvent(w);
}
void QBBNavigatorEventHandler::handleExit()