1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-23 03:02:53 +01:00

game_list: fix sort and scroll

This commit is contained in:
Megamouse 2017-07-25 11:30:50 +02:00 committed by Ivan
parent 60e2928ec1
commit ff772dd28b
2 changed files with 13 additions and 10 deletions

View File

@ -321,7 +321,7 @@ void game_list_frame::OnColClicked(int col)
xgui_settings->SetValue(GUI::gl_sortAsc, m_colSortOrder == Qt::AscendingOrder); xgui_settings->SetValue(GUI::gl_sortAsc, m_colSortOrder == Qt::AscendingOrder);
xgui_settings->SetValue(GUI::gl_sortCol, col); xgui_settings->SetValue(GUI::gl_sortCol, col);
gameList->sortByColumn(m_sortColumn, m_colSortOrder); SortGameList();
} }
// Filter for Categories // Filter for Categories
@ -343,6 +343,15 @@ void game_list_frame::FilterData()
} }
} }
void game_list_frame::SortGameList()
{
gameList->sortByColumn(m_sortColumn, m_colSortOrder);
gameList->verticalHeader()->setMinimumSectionSize(m_Icon_Size.height());
gameList->verticalHeader()->setMaximumSectionSize(m_Icon_Size.height());
gameList->resizeRowsToContents();
gameList->resizeColumnToContents(0);
}
void game_list_frame::Refresh(bool fromDrive) void game_list_frame::Refresh(bool fromDrive)
{ {
if (fromDrive) if (fromDrive)
@ -471,13 +480,7 @@ void game_list_frame::Refresh(bool fromDrive)
int row = PopulateGameList(); int row = PopulateGameList();
FilterData(); FilterData();
gameList->selectRow(row); gameList->selectRow(row);
gameList->sortByColumn(m_sortColumn, m_colSortOrder); SortGameList();
gameList->verticalHeader()->setMinimumSectionSize(m_Icon_Size.height());
gameList->verticalHeader()->setMaximumSectionSize(m_Icon_Size.height());
gameList->resizeRowsToContents();
gameList->resizeColumnToContents(0);
gameList->scrollToTop(); // fix drunk scroll behaviour (may still not be perfect)
gameList->scrollToBottom(); // fix drunk scroll behaviour (may still not be perfect)
gameList->scrollTo(gameList->currentIndex(), QAbstractItemView::PositionAtCenter); gameList->scrollTo(gameList->currentIndex(), QAbstractItemView::PositionAtCenter);
} }
else else
@ -842,8 +845,7 @@ int game_list_frame::PopulateGameList()
std::string selected_item = CurrentSelectionIconPath(); std::string selected_item = CurrentSelectionIconPath();
// Hack to delete everything without removing the headers. gameList->clearContents();
gameList->setRowCount(0);
gameList->setRowCount(m_game_data.size()); gameList->setRowCount(m_game_data.size());

View File

@ -218,6 +218,7 @@ protected:
private: private:
void PopulateGameGrid(uint maxCols, const QSize& image_size, const QColor& image_color); void PopulateGameGrid(uint maxCols, const QSize& image_size, const QColor& image_color);
void FilterData(); void FilterData();
void SortGameList();
int PopulateGameList(); int PopulateGameList();
bool SearchMatchesApp(const std::string& name, const std::string& serial); bool SearchMatchesApp(const std::string& name, const std::string& serial);