fix current index, depends on value of setting

fix default value of the combobox for the collapse lines, incorrectly
always shows first item of the box, instead of current value
This commit is contained in:
hemirt 2018-07-03 15:43:54 +02:00
parent 37d3f5a24a
commit 4f30d950c7

View file

@ -85,6 +85,14 @@ AppearancePage::AppearancePage()
auto *combo = new QComboBox(this);
combo->addItems({"Never", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12",
"13", "14", "15"});
const auto currentIndex = []() -> int {
auto val = getApp()->settings->collpseMessagesMinLines.getValue();
if (val > 0) {
--val;
}
return val;
}();
combo->setCurrentIndex(currentIndex);
QObject::connect(combo, &QComboBox::currentTextChanged, [](const QString &str) {
getApp()->settings->collpseMessagesMinLines = str.toInt();