Move ComboBoxLoadFromSettings function to settingspage
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include <QRadioButton>
|
||||
#include <QSlider>
|
||||
#include <QLineEdit>
|
||||
#include <QSettings>
|
||||
#include <QShowEvent>
|
||||
|
||||
#include "core/logging.h"
|
||||
@@ -127,3 +128,22 @@ void SettingsPage::Apply() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SettingsPage::ComboBoxLoadFromSettings(const QSettings &s, QComboBox *combobox, const QString &setting, const QString &default_value) {
|
||||
|
||||
QString value = s.value(setting, default_value).toString();
|
||||
int i = combobox->findData(value);
|
||||
if (i == -1) i = combobox->findData(default_value);
|
||||
combobox->setCurrentIndex(i);
|
||||
|
||||
}
|
||||
|
||||
void SettingsPage::ComboBoxLoadFromSettings(const QSettings &s, QComboBox *combobox, const QString &setting, const int default_value) {
|
||||
|
||||
int value = s.value(setting, default_value).toInt();
|
||||
int i = combobox->findData(value);
|
||||
if (i == -1) i = combobox->findData(default_value);
|
||||
combobox->setCurrentIndex(i);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user