diff options
Diffstat (limited to 'utils/themeeditor/gui/devicestate.cpp')
-rw-r--r-- | utils/themeeditor/gui/devicestate.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/utils/themeeditor/gui/devicestate.cpp b/utils/themeeditor/gui/devicestate.cpp index 3933926a48..80efd4d4d1 100644 --- a/utils/themeeditor/gui/devicestate.cpp +++ b/utils/themeeditor/gui/devicestate.cpp | |||
@@ -234,6 +234,47 @@ QVariant DeviceState::data(QString tag) | |||
234 | return QVariant(); | 234 | return QVariant(); |
235 | } | 235 | } |
236 | 236 | ||
237 | void DeviceState::setData(QString tag, QVariant data) | ||
238 | { | ||
239 | QPair<InputType, QWidget*> found = | ||
240 | inputs.value(tag, QPair<InputType, QWidget*>(Slide, 0)); | ||
241 | |||
242 | if(found.second == 0) | ||
243 | return; | ||
244 | |||
245 | switch(found.first) | ||
246 | { | ||
247 | case Text: | ||
248 | dynamic_cast<QLineEdit*>(found.second)->setText(data.toString()); | ||
249 | break; | ||
250 | |||
251 | case Slide: | ||
252 | dynamic_cast<QSlider*>(found.second)->setValue(data.toInt()); | ||
253 | break; | ||
254 | |||
255 | case Spin: | ||
256 | dynamic_cast<QSpinBox*>(found.second)->setValue(data.toInt()); | ||
257 | break; | ||
258 | |||
259 | case DSpin: | ||
260 | dynamic_cast<QDoubleSpinBox*>(found.second)->setValue(data.toDouble()); | ||
261 | break; | ||
262 | |||
263 | case Combo: | ||
264 | dynamic_cast<QComboBox*> | ||
265 | (found.second)-> | ||
266 | setCurrentIndex(dynamic_cast<QComboBox*> | ||
267 | (found.second)->findText(data.toString())); | ||
268 | break; | ||
269 | |||
270 | case Check: | ||
271 | dynamic_cast<QCheckBox*>(found.second)->setChecked(data.toBool()); | ||
272 | break; | ||
273 | } | ||
274 | |||
275 | emit settingsChanged(); | ||
276 | } | ||
277 | |||
237 | void DeviceState::input() | 278 | void DeviceState::input() |
238 | { | 279 | { |
239 | emit settingsChanged(); | 280 | emit settingsChanged(); |