mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-14 18:58:36 +12:00
Qt: simplify occasions of restoreState
This commit is contained in:
parent
31101b4828
commit
bff9a06f9f
3 changed files with 5 additions and 31 deletions
|
@ -243,24 +243,15 @@ trophy_manager_dialog::trophy_manager_dialog(std::shared_ptr<gui_settings> gui_s
|
|||
if (!restoreGeometry(m_gui_settings->GetValue(gui::tr_geometry).toByteArray()))
|
||||
resize(QDesktopWidget().availableGeometry().size() * 0.7);
|
||||
|
||||
QByteArray splitterstate = m_gui_settings->GetValue(gui::tr_splitterState).toByteArray();
|
||||
if (splitterstate.isEmpty())
|
||||
if (!m_splitter->restoreState(m_gui_settings->GetValue(gui::tr_splitterState).toByteArray()))
|
||||
{
|
||||
const int width_left = m_splitter->width() * 0.4;
|
||||
const int width_right = m_splitter->width() - width_left;
|
||||
m_splitter->setSizes({ width_left, width_right });
|
||||
}
|
||||
else
|
||||
{
|
||||
m_splitter->restoreState(splitterstate);
|
||||
}
|
||||
|
||||
QByteArray game_table_state = m_gui_settings->GetValue(gui::tr_games_state).toByteArray();
|
||||
if (!game_table_state.isEmpty())
|
||||
{
|
||||
m_game_table->horizontalHeader()->restoreState(game_table_state);
|
||||
}
|
||||
else if (m_game_table->rowCount() > 0)
|
||||
if (!m_game_table->horizontalHeader()->restoreState(game_table_state) && m_game_table->rowCount())
|
||||
{
|
||||
// If no settings exist, go to default.
|
||||
m_game_table->verticalHeader()->resizeSections(QHeaderView::ResizeMode::ResizeToContents);
|
||||
|
@ -268,11 +259,7 @@ trophy_manager_dialog::trophy_manager_dialog(std::shared_ptr<gui_settings> gui_s
|
|||
}
|
||||
|
||||
QByteArray trophy_table_state = m_gui_settings->GetValue(gui::tr_trophy_state).toByteArray();
|
||||
if (!trophy_table_state.isEmpty())
|
||||
{
|
||||
m_trophy_table->horizontalHeader()->restoreState(trophy_table_state);
|
||||
}
|
||||
else if (m_trophy_table->rowCount() > 0)
|
||||
if (!m_trophy_table->horizontalHeader()->restoreState(trophy_table_state) && m_trophy_table->rowCount())
|
||||
{
|
||||
// If no settings exist, go to default.
|
||||
m_trophy_table->verticalHeader()->resizeSections(QHeaderView::ResizeMode::ResizeToContents);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue