mirror of
				https://git.suyu.dev/suyu/suyu
				synced 2025-11-04 00:49:02 -06:00 
			
		
		
		
	Don’t focus the search field if the game is empty
This commit is contained in:
		@@ -236,8 +236,10 @@ GameList::~GameList() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void GameList::setFilterFocus() {
 | 
					void GameList::setFilterFocus() {
 | 
				
			||||||
 | 
					    if (tree_view->model()->rowCount() > 0) {
 | 
				
			||||||
        search_field->setFocus();
 | 
					        search_field->setFocus();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void GameList::setFilterVisible(bool visibility) {
 | 
					void GameList::setFilterVisible(bool visibility) {
 | 
				
			||||||
    search_field->setVisible(visibility);
 | 
					    search_field->setVisible(visibility);
 | 
				
			||||||
@@ -271,8 +273,10 @@ void GameList::DonePopulating() {
 | 
				
			|||||||
    tree_view->setEnabled(true);
 | 
					    tree_view->setEnabled(true);
 | 
				
			||||||
    int rowCount = tree_view->model()->rowCount();
 | 
					    int rowCount = tree_view->model()->rowCount();
 | 
				
			||||||
    search_field->setFilterResult(rowCount, rowCount);
 | 
					    search_field->setFilterResult(rowCount, rowCount);
 | 
				
			||||||
 | 
					    if (rowCount > 0) {
 | 
				
			||||||
        search_field->setFocus();
 | 
					        search_field->setFocus();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void GameList::PopupContextMenu(const QPoint& menu_location) {
 | 
					void GameList::PopupContextMenu(const QPoint& menu_location) {
 | 
				
			||||||
    QModelIndex item = tree_view->indexAt(menu_location);
 | 
					    QModelIndex item = tree_view->indexAt(menu_location);
 | 
				
			||||||
@@ -296,7 +300,6 @@ void GameList::PopulateAsync(const QString& dir_path, bool deep_scan) {
 | 
				
			|||||||
        !FileUtil::IsDirectory(dir_path.toStdString())) {
 | 
					        !FileUtil::IsDirectory(dir_path.toStdString())) {
 | 
				
			||||||
        LOG_ERROR(Frontend, "Could not find game list folder at %s", dir_path.toLocal8Bit().data());
 | 
					        LOG_ERROR(Frontend, "Could not find game list folder at %s", dir_path.toLocal8Bit().data());
 | 
				
			||||||
        search_field->setFilterResult(0, 0);
 | 
					        search_field->setFilterResult(0, 0);
 | 
				
			||||||
        search_field->setFocus();
 | 
					 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user