QWidgetWindow: Prioritize keyboard grabber over popup for key events.
Fix the inline editor of the QMenuBar in Qt Designer not working due to the key events being sent to the QMenu which is open at that time. Task-number: QTBUG-31059 Change-Id: Ic96bc119d0d2566d8f8d6ee62858445a70a447b7 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
This commit is contained in:
parent
2e82e474d6
commit
38dc6ccca0
@ -490,14 +490,12 @@ void QWidgetWindow::handleKeyEvent(QKeyEvent *event)
|
|||||||
if (QApplicationPrivate::instance()->modalState() && !qt_try_modal(m_widget, event->type()))
|
if (QApplicationPrivate::instance()->modalState() && !qt_try_modal(m_widget, event->type()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QObject *receiver = 0;
|
QObject *receiver = QWidget::keyboardGrabber();
|
||||||
if (QApplicationPrivate::inPopupMode()) {
|
if (!receiver && QApplicationPrivate::inPopupMode()) {
|
||||||
QWidget *popup = QApplication::activePopupWidget();
|
QWidget *popup = QApplication::activePopupWidget();
|
||||||
QWidget *popupFocusWidget = popup->focusWidget();
|
QWidget *popupFocusWidget = popup->focusWidget();
|
||||||
receiver = popupFocusWidget ? popupFocusWidget : popup;
|
receiver = popupFocusWidget ? popupFocusWidget : popup;
|
||||||
}
|
}
|
||||||
if (!receiver)
|
|
||||||
receiver = QWidget::keyboardGrabber();
|
|
||||||
if (!receiver)
|
if (!receiver)
|
||||||
receiver = focusObject();
|
receiver = focusObject();
|
||||||
QGuiApplication::sendSpontaneousEvent(receiver, event);
|
QGuiApplication::sendSpontaneousEvent(receiver, event);
|
||||||
|
Loading…
Reference in New Issue
Block a user