Qt: simplify occasions of restoreState

This commit is contained in:
Megamouse 2018-05-22 11:15:18 +02:00 committed by Ani
parent 31101b4828
commit bff9a06f9f
3 changed files with 5 additions and 31 deletions

View file

@ -174,12 +174,7 @@ game_list_frame::game_list_frame(std::shared_ptr<gui_settings> guiSettings, std:
void game_list_frame::LoadSettings()
{
QByteArray state = xgui_settings->GetValue(gui::gl_state).toByteArray();
if (!state.isEmpty())
{
m_gameList->horizontalHeader()->restoreState(state);
}
else if (m_gameList->rowCount() > 0)
if (!m_gameList->horizontalHeader()->restoreState(state) && m_gameList->rowCount())
{
// If no settings exist, go to default.
m_gameList->verticalHeader()->resizeSections(QHeaderView::ResizeMode::ResizeToContents);
@ -198,9 +193,7 @@ void game_list_frame::LoadSettings()
m_gameList->horizontalHeader()->restoreState(m_gameList->horizontalHeader()->saveState());
m_colSortOrder = xgui_settings->GetValue(gui::gl_sortAsc).toBool() ? Qt::AscendingOrder : Qt::DescendingOrder;
m_sortColumn = xgui_settings->GetValue(gui::gl_sortCol).toInt();
m_categoryFilters = xgui_settings->GetGameListCategoryFilters();
Refresh(true);