improvements on settings dialog
This commit is contained in:
@@ -59,11 +59,12 @@ QCheckBox *SettingsLayout::addCheckbox(const QString &text,
|
||||
return check;
|
||||
}
|
||||
|
||||
QComboBox *SettingsLayout::addDropdown(const QString &text,
|
||||
const QStringList &list)
|
||||
ComboBox *SettingsLayout::addDropdown(const QString &text,
|
||||
const QStringList &list)
|
||||
{
|
||||
auto layout = new QHBoxLayout;
|
||||
auto combo = new QComboBox;
|
||||
auto combo = new ComboBox;
|
||||
combo->setFocusPolicy(Qt::StrongFocus);
|
||||
combo->addItems(list);
|
||||
|
||||
layout->addWidget(new QLabel(text + ":"));
|
||||
@@ -74,7 +75,7 @@ QComboBox *SettingsLayout::addDropdown(const QString &text,
|
||||
return combo;
|
||||
}
|
||||
|
||||
QComboBox *SettingsLayout::addDropdown(
|
||||
ComboBox *SettingsLayout::addDropdown(
|
||||
const QString &text, const QStringList &items,
|
||||
pajlada::Settings::Setting<QString> &setting)
|
||||
{
|
||||
@@ -203,7 +204,7 @@ void GeneralPage::initLayout(SettingsLayout &layout)
|
||||
|
||||
layout.addTitle("Emotes");
|
||||
layout.addDropdown<float>(
|
||||
"Emote size", {"0.5x", "0.75x", "Default", "1.25", "1.5x", "2x"},
|
||||
"Emote size", {"0.5x", "0.75x", "Default", "1.25x", "1.5x", "2x"},
|
||||
s.emoteScale,
|
||||
[](auto val) {
|
||||
if (val == 1)
|
||||
|
||||
@@ -56,6 +56,15 @@ struct DropdownArgs {
|
||||
QComboBox *combobox;
|
||||
};
|
||||
|
||||
class ComboBox : public QComboBox
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
void wheelEvent(QWheelEvent *event) override
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class SettingsLayout : public QVBoxLayout
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -64,12 +73,12 @@ public:
|
||||
TitleLabel *addTitle(const QString &text);
|
||||
TitleLabel2 *addTitle2(const QString &text);
|
||||
QCheckBox *addCheckbox(const QString &text, BoolSetting &setting);
|
||||
QComboBox *addDropdown(const QString &text, const QStringList &items);
|
||||
QComboBox *addDropdown(const QString &text, const QStringList &items,
|
||||
pajlada::Settings::Setting<QString> &setting);
|
||||
ComboBox *addDropdown(const QString &text, const QStringList &items);
|
||||
ComboBox *addDropdown(const QString &text, const QStringList &items,
|
||||
pajlada::Settings::Setting<QString> &setting);
|
||||
|
||||
template <typename T>
|
||||
QComboBox *addDropdown(
|
||||
ComboBox *addDropdown(
|
||||
const QString &text, const QStringList &items,
|
||||
pajlada::Settings::Setting<T> &setting,
|
||||
std::function<boost::variant<int, QString>(T)> getValue,
|
||||
|
||||
Reference in New Issue
Block a user