[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-kernel
Subject:    [PATCH] xconfig: Set keyboard focus to line edit whenever the search dialog opens
From:       Peter Kümmel <syntheticpp () gmx ! net>
Date:       2014-11-06 12:03:03
Message-ID: 1415275383-15301-4-git-send-email-syntheticpp () gmx ! net
[Download RAW message or body]

When after a search on a result is clicked the focus jumps to
the result list. So after closing and reopening the dialog the
field does not have the focus any more. This is annoying when
you press Ctrl-F and start typing for a new search because
the text shows not up in the edit field but gets lost. You
have to click additionally into the edit field to move the
focus to this field. With this patch the focus is always set
to the edit field when the dialog opens.

Signed-off-by: Peter Kümmel <syntheticpp@gmx.net>
---
 scripts/kconfig/qconf.cc | 6 ++++++
 scripts/kconfig/qconf.h  | 1 +
 2 files changed, 7 insertions(+)

diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 9d3b04b..7ef498d 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1235,6 +1235,11 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
 	}
 }
 
+void ConfigSearchWindow::setFocusOnLineEdit()
+{
+	editField->setFocus(Qt::OtherFocusReason);
+}
+
 void ConfigSearchWindow::saveSettings(void)
 {
 	if (name()) {
@@ -1506,6 +1511,7 @@ void ConfigMainWindow::searchConfig(void)
 	if (!searchWindow)
 		searchWindow = new ConfigSearchWindow(this, "search");
 	searchWindow->show();
+	searchWindow->setFocusOnLineEdit();
 }
 
 void ConfigMainWindow::changeMenu(struct menu *menu)
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index bde0c6b..6f2c4d6 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -288,6 +288,7 @@ public:
 public slots:
 	void saveSettings(void);
 	void search(void);
+	void setFocusOnLineEdit(void);
 
 protected:
 	QLineEdit* editField;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic