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>bb10
parent
ef459193ec
commit
e2f57d59d8
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue