1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Fix #2228: Friendlist too wide on first start

This commit is contained in:
tux3 2015-10-07 15:19:21 +02:00
parent 6c26262ba3
commit 56cccc7492

View File

@ -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<int> 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);