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

@ -172,18 +172,12 @@ void debugger_frame::closeEvent(QCloseEvent *event)
void debugger_frame::showEvent(QShowEvent * event)
{
// resize splitter widgets
QByteArray state = xgui_settings->GetValue(gui::d_splitterState).toByteArray();
if (state.isEmpty()) // resize 2:1
if (!m_splitter->restoreState(xgui_settings->GetValue(gui::d_splitterState).toByteArray()))
{
const int width_right = width() / 3;
const int width_left = width() - width_right;
m_splitter->setSizes({width_left, width_right});
}
else
{
m_splitter->restoreState(state);
}
QDockWidget::showEvent(event);
}