From f8f882ecdf1b3a4a87ed7dcabbd3eeedcaaf0374 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 1 Dec 2017 15:54:19 +0100 Subject: Fix focus handling in android manifest editor If focus gets set on the editor widget, either the current focus widget of the current page (gui/text) should receive application focus, or the page itself (where the gui page should defer that to its first input widget). Change-Id: I8a35c2e9ca06fe694069b594788f7f40307abbda Reviewed-by: Vikas Pachdha --- src/plugins/android/androidmanifesteditorwidget.cpp | 11 +++++++++++ src/plugins/android/androidmanifesteditorwidget.h | 1 + 2 files changed, 12 insertions(+) diff --git a/src/plugins/android/androidmanifesteditorwidget.cpp b/src/plugins/android/androidmanifesteditorwidget.cpp index 5bcd699816..91e8a43b64 100644 --- a/src/plugins/android/androidmanifesteditorwidget.cpp +++ b/src/plugins/android/androidmanifesteditorwidget.cpp @@ -462,6 +462,7 @@ void AndroidManifestEditorWidget::initializePage() QScrollArea *mainWidgetScrollArea = new QScrollArea; mainWidgetScrollArea->setWidgetResizable(true); mainWidgetScrollArea->setWidget(mainWidget); + mainWidgetScrollArea->setFocusProxy(m_packageNameLineEdit); insertWidget(General, mainWidgetScrollArea); insertWidget(Source, m_textEditorWidget); @@ -477,6 +478,16 @@ bool AndroidManifestEditorWidget::eventFilter(QObject *obj, QEvent *event) return QWidget::eventFilter(obj, event); } +void AndroidManifestEditorWidget::focusInEvent(QFocusEvent *event) +{ + if (currentWidget()) { + if (currentWidget()->focusWidget()) + currentWidget()->focusWidget()->setFocus(event->reason()); + else + currentWidget()->setFocus(event->reason()); + } +} + void AndroidManifestEditorWidget::updateTargetComboBox() { Project *project = androidProject(m_textEditorWidget->textDocument()->filePath()); diff --git a/src/plugins/android/androidmanifesteditorwidget.h b/src/plugins/android/androidmanifesteditorwidget.h index 39cb61ef64..59a879aa3c 100644 --- a/src/plugins/android/androidmanifesteditorwidget.h +++ b/src/plugins/android/androidmanifesteditorwidget.h @@ -112,6 +112,7 @@ signals: protected: bool eventFilter(QObject *obj, QEvent *event); + void focusInEvent(QFocusEvent *event); private: void setLDPIIcon(); -- cgit v1.2.1