mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
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:
parent
37d3f5a24a
commit
4f30d950c7
1 changed files with 8 additions and 0 deletions
|
@ -85,6 +85,14 @@ AppearancePage::AppearancePage()
|
||||||
auto *combo = new QComboBox(this);
|
auto *combo = new QComboBox(this);
|
||||||
combo->addItems({"Never", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12",
|
combo->addItems({"Never", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12",
|
||||||
"13", "14", "15"});
|
"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) {
|
QObject::connect(combo, &QComboBox::currentTextChanged, [](const QString &str) {
|
||||||
getApp()->settings->collpseMessagesMinLines = str.toInt();
|
getApp()->settings->collpseMessagesMinLines = str.toInt();
|
||||||
|
|
Loading…
Reference in a new issue