4 #include <score_lib_base_export.h>
12 class SettingsDelegateModel;
13 template <
class Model>
14 class SettingsDelegatePresenter;
16 template <
class Model>
21 using QObject::QObject;
23 virtual void setPresenter(
Presenter* presenter) { m_presenter = presenter; }
25 Presenter* getPresenter() {
return m_presenter; }
27 virtual QWidget* getWidget()
36 #define SETTINGS_UI_COMBOBOX_HPP(Control) \
38 void set##Control(QString); \
41 void Control##Changed(QString arg) W_SIGNAL(Control##Changed, arg); \
44 QComboBox* m_##Control{};
46 #define SETTINGS_UI_NUM_COMBOBOX_HPP(Control) \
48 void set##Control(int); \
49 void Control##Changed(int arg) W_SIGNAL(Control##Changed, arg); \
52 QComboBox* m_##Control{};
54 #define SETTINGS_UI_TOGGLE_HPP(Control) \
56 void set##Control(bool); \
57 void Control##Changed(bool arg) W_SIGNAL(Control##Changed, arg); \
60 QCheckBox* m_##Control{};
62 #define SETTINGS_UI_SPINBOX_HPP(Control) \
64 void set##Control(int); \
65 void Control##Changed(int arg) W_SIGNAL(Control##Changed, arg); \
68 QSpinBox* m_##Control{};
70 #define SETTINGS_UI_DOUBLE_SPINBOX_HPP(Control) \
72 void set##Control(double); \
73 void Control##Changed(double arg) W_SIGNAL(Control##Changed, arg); \
76 QDoubleSpinBox* m_##Control{};
78 #define SETTINGS_UI_COMBOBOX_SETUP(Text, Control, Values) \
79 m_##Control = new QComboBox{m_widg}; \
80 m_##Control->addItems(Values); \
81 lay->addRow(tr(Text), m_##Control); \
83 m_##Control, SignalUtils::QComboBox_currentIndexChanged_int(), this, \
84 [this](int i) { Control##Changed(m_##Control->itemText(i)); });
86 #define SETTINGS_UI_NUM_COMBOBOX_SETUP(Text, Control, Values) \
87 m_##Control = new QComboBox{m_widg}; \
88 for(auto v : Values) \
89 m_##Control->addItem(QString::number(v)); \
90 lay->addRow(tr(Text), m_##Control); \
92 m_##Control, SignalUtils::QComboBox_currentIndexChanged_int(), this, \
93 [this](int i) { Control##Changed(m_##Control->itemText(i).toInt()); });
95 #define SETTINGS_UI_SPINBOX_SETUP(Text, Control) \
96 m_##Control = new QSpinBox{m_widg}; \
97 lay->addRow(tr(Text), m_##Control); \
99 m_##Control, SignalUtils::QSpinBox_valueChanged_int(), this, \
100 &View::Control##Changed);
102 #define SETTINGS_UI_DOUBLE_SPINBOX_SETUP(Text, Control) \
103 m_##Control = new QDoubleSpinBox{m_widg}; \
104 lay->addRow(tr(Text), m_##Control); \
106 m_##Control, SignalUtils::QDoubleSpinBox_valueChanged_double(), this, \
107 &View::Control##Changed);
109 #define SETTINGS_UI_TOGGLE_SETUP(Text, Control) \
110 m_##Control = new QCheckBox{tr(Text), m_widg}; \
111 lay->addRow(m_##Control); \
112 connect(m_##Control, &QCheckBox::toggled, this, &View::Control##Changed);
114 #define SETTINGS_UI_COMBOBOX_IMPL(Control) \
115 void View::set##Control(QString val) \
117 int idx = m_##Control->findData(QVariant::fromValue(val)); \
118 if(idx != -1 && idx != m_##Control->currentIndex()) \
119 m_##Control->setCurrentIndex(idx); \
122 idx = m_##Control->findText(val); \
123 if(idx != -1 && idx != m_##Control->currentIndex()) \
124 m_##Control->setCurrentIndex(idx); \
128 #define SETTINGS_UI_NUM_COMBOBOX_IMPL(Control) \
129 void View::set##Control(int val) \
131 int idx = m_##Control->findData(QVariant::fromValue(val)); \
132 if(idx != -1 && idx != m_##Control->currentIndex()) \
133 m_##Control->setCurrentIndex(idx); \
136 idx = m_##Control->findText(QString::number(val)); \
137 if(idx != -1 && idx != m_##Control->currentIndex()) \
138 m_##Control->setCurrentIndex(idx); \
142 #define SETTINGS_UI_SPINBOX_IMPL(Control) \
143 void View::set##Control(int val) \
145 int cur = m_##Control->value(); \
147 m_##Control->setValue(val); \
150 #define SETTINGS_UI_DOUBLE_SPINBOX_IMPL(Control) \
151 void View::set##Control(double val) \
153 int cur = m_##Control->value(); \
155 m_##Control->setValue(val); \
158 #define SETTINGS_UI_TOGGLE_IMPL(Control) \
159 void View::set##Control(bool val) \
161 bool cur = m_##Control->isChecked(); \
163 m_##Control->setChecked(val); \
Definition: SettingsDelegatePresenter.hpp:17
Definition: SettingsDelegateView.hpp:18
Base toolkit upon which the software is built.
Definition: Application.cpp:90