Qt: apply header states after populating the tables

This commit is contained in:
Megamouse 2018-05-22 11:38:02 +02:00 committed by Ani
parent bff9a06f9f
commit 325048a134
2 changed files with 8 additions and 7 deletions

View file

@ -173,6 +173,12 @@ game_list_frame::game_list_frame(std::shared_ptr<gui_settings> guiSettings, std:
void game_list_frame::LoadSettings() void game_list_frame::LoadSettings()
{ {
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);
QByteArray state = xgui_settings->GetValue(gui::gl_state).toByteArray(); QByteArray state = xgui_settings->GetValue(gui::gl_state).toByteArray();
if (!m_gameList->horizontalHeader()->restoreState(state) && m_gameList->rowCount()) if (!m_gameList->horizontalHeader()->restoreState(state) && m_gameList->rowCount())
{ {
@ -191,12 +197,6 @@ void game_list_frame::LoadSettings()
FixNarrowColumns(); FixNarrowColumns();
m_gameList->horizontalHeader()->restoreState(m_gameList->horizontalHeader()->saveState()); 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);
} }
game_list_frame::~game_list_frame() game_list_frame::~game_list_frame()

View file

@ -250,6 +250,8 @@ trophy_manager_dialog::trophy_manager_dialog(std::shared_ptr<gui_settings> gui_s
m_splitter->setSizes({ width_left, width_right }); m_splitter->setSizes({ width_left, width_right });
} }
PopulateUI();
QByteArray game_table_state = m_gui_settings->GetValue(gui::tr_games_state).toByteArray(); QByteArray game_table_state = m_gui_settings->GetValue(gui::tr_games_state).toByteArray();
if (!m_game_table->horizontalHeader()->restoreState(game_table_state) && m_game_table->rowCount()) if (!m_game_table->horizontalHeader()->restoreState(game_table_state) && m_game_table->rowCount())
{ {
@ -266,7 +268,6 @@ trophy_manager_dialog::trophy_manager_dialog(std::shared_ptr<gui_settings> gui_s
m_trophy_table->horizontalHeader()->resizeSections(QHeaderView::ResizeMode::ResizeToContents); m_trophy_table->horizontalHeader()->resizeSections(QHeaderView::ResizeMode::ResizeToContents);
} }
PopulateUI();
ApplyFilter(); ApplyFilter();
// Make connects // Make connects