Actually use stored size in splitter after restart

This commit is contained in:
Nicolas Werner 2021-01-21 13:45:50 +01:00
parent f31e2ffc7b
commit 3b0d14b1b9
1 changed files with 5 additions and 3 deletions

View File

@ -37,20 +37,22 @@ Splitter::restoreSizes(int fallback)
int savedWidth = settings.value("sidebar/width").toInt(); int savedWidth = settings.value("sidebar/width").toInt();
auto left = widget(0); auto left = widget(0);
if (savedWidth == 0) { if (savedWidth <= 0) {
hideSidebar(); hideSidebar();
return; return;
} else if (savedWidth == sz_.small) { } else if (savedWidth <= sz_.small) {
if (left) { if (left) {
left->setMinimumWidth(sz_.small); left->setMinimumWidth(sz_.small);
left->setMaximumWidth(sz_.small); left->setMaximumWidth(sz_.small);
return; return;
} }
} else if (savedWidth < sz_.normal) {
savedWidth = sz_.normal;
} }
left->setMinimumWidth(sz_.normal); left->setMinimumWidth(sz_.normal);
left->setMaximumWidth(2 * sz_.normal); left->setMaximumWidth(2 * sz_.normal);
setSizes({sz_.normal, fallback - sz_.normal}); setSizes({savedWidth, fallback - savedWidth});
setStretchFactor(0, 0); setStretchFactor(0, 0);
setStretchFactor(1, 1); setStretchFactor(1, 1);