From 56cccc7492fc8e4550e2ebca8d89fee9104e93fd Mon Sep 17 00:00:00 2001 From: tux3 Date: Wed, 7 Oct 2015 15:19:21 +0200 Subject: [PATCH] Fix #2228: Friendlist too wide on first start --- src/widget/widget.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index 733a23afc..1fa7e7f43 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -341,7 +341,16 @@ void Widget::init() //restore window state restoreGeometry(Settings::getInstance().getWindowGeometry()); restoreState(Settings::getInstance().getWindowState()); - ui->mainSplitter->restoreState(Settings::getInstance().getSplitterState()); + if (!ui->mainSplitter->restoreState(Settings::getInstance().getSplitterState())) + { + // Set the status panel (friendlist) to a reasonnable width by default/on first start + constexpr int spWidthPc = 33; + ui->mainSplitter->resize(size()); + QList sizes = ui->mainSplitter->sizes(); + sizes[0] = ui->mainSplitter->width()*spWidthPc/100; + sizes[1] = ui->mainSplitter->width() - sizes[0]; + ui->mainSplitter->setSizes(sizes); + } connect(settingsWidget, &SettingsWidget::compactToggled, contactListWidget, &FriendListWidget::onCompactChanged); connect(settingsWidget, &SettingsWidget::groupchatPositionToggled, contactListWidget, &FriendListWidget::onGroupchatPositionChanged);