summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2012-06-11 16:13:24 +0200
committerQt by Nokia <qt-info@nokia.com>2012-06-13 02:29:46 +0200
commite2f57d59d814128c5b07f26b368ea07019e154f7 (patch)
treee7f415c88f89c496b3f08bc5fad724a0fef30628 /src/widgets
parentef459193ec927f347a2c91b180994428c6ea1a97 (diff)
Send key events to pop-up widget in case there is one.
Make QApplicationPrivate::inPopupMode() static for convenience. Task-number: QTBUG-26095 Change-Id: I98dc1e40d357592b790cd51d7aca60c2be9f380f Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/kernel/qapplication.cpp2
-rw-r--r--src/widgets/kernel/qapplication_p.h2
-rw-r--r--src/widgets/kernel/qwidgetwindow_qpa.cpp10
3 files changed, 10 insertions, 4 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 0553dabe51..7999eeb109 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -3972,7 +3972,7 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e)
\snippet code/src_gui_kernel_qapplication.cpp 13
*/
-bool QApplicationPrivate::inPopupMode() const
+bool QApplicationPrivate::inPopupMode()
{
return QApplicationPrivate::popupWidgets != 0;
}
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index f700851cf3..1e5705524e 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -170,7 +170,7 @@ public:
static void x11_initialize_style();
#endif
- bool inPopupMode() const;
+ static bool inPopupMode();
void closePopup(QWidget *popup);
void openPopup(QWidget *popup);
static void setFocusWidget(QWidget *focus, Qt::FocusReason reason);
diff --git a/src/widgets/kernel/qwidgetwindow_qpa.cpp b/src/widgets/kernel/qwidgetwindow_qpa.cpp
index 21a0ada831..7ae0a5bf76 100644
--- a/src/widgets/kernel/qwidgetwindow_qpa.cpp
+++ b/src/widgets/kernel/qwidgetwindow_qpa.cpp
@@ -342,8 +342,14 @@ void QWidgetWindow::handleKeyEvent(QKeyEvent *event)
if (QApplicationPrivate::instance()->modalState() && !qt_try_modal(m_widget, event->type()))
return;
- QObject *receiver = focusObject();
-
+ QObject *receiver = 0;
+ if (QApplicationPrivate::inPopupMode()) {
+ QWidget *popup = QApplication::activePopupWidget();
+ QWidget *popupFocusWidget = popup->focusWidget();
+ receiver = popupFocusWidget ? popupFocusWidget : popup;
+ }
+ if (!receiver)
+ receiver = focusObject();
QGuiApplication::sendSpontaneousEvent(receiver, event);
}