From db256ea395e3b160bd161ddb5205870c29697150 Mon Sep 17 00:00:00 2001 From: Nico Bosshard Date: Sat, 6 May 2017 12:08:28 +0200 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20focus=20the=20search=20field=20?= =?UTF-8?q?if=20the=20game=20is=20empty?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/citra_qt/game_list.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/citra_qt/game_list.cpp b/src/citra_qt/game_list.cpp index 582aa08570..51257520b9 100644 --- a/src/citra_qt/game_list.cpp +++ b/src/citra_qt/game_list.cpp @@ -236,7 +236,9 @@ GameList::~GameList() { } void GameList::setFilterFocus() { - search_field->setFocus(); + if (tree_view->model()->rowCount() > 0) { + search_field->setFocus(); + } } void GameList::setFilterVisible(bool visibility) { @@ -271,7 +273,9 @@ void GameList::DonePopulating() { tree_view->setEnabled(true); int rowCount = tree_view->model()->rowCount(); search_field->setFilterResult(rowCount, rowCount); - search_field->setFocus(); + if (rowCount > 0) { + search_field->setFocus(); + } } void GameList::PopupContextMenu(const QPoint& menu_location) { @@ -296,7 +300,6 @@ void GameList::PopulateAsync(const QString& dir_path, bool deep_scan) { !FileUtil::IsDirectory(dir_path.toStdString())) { LOG_ERROR(Frontend, "Could not find game list folder at %s", dir_path.toLocal8Bit().data()); search_field->setFilterResult(0, 0); - search_field->setFocus(); return; }