src/dialogs/configdialog.cpp

changeset 985
ed7b31b9f904
parent 984
a7b6f987d269
child 997
1b49f34e533d
equal deleted inserted replaced
984:a7b6f987d269 985:ed7b31b9f904
64 QDoubleSpinBox* doublespinbox; 64 QDoubleSpinBox* doublespinbox;
65 QSlider* slider; 65 QSlider* slider;
66 QCheckBox* checkbox; 66 QCheckBox* checkbox;
67 QPushButton* button; 67 QPushButton* button;
68 68
69 if ((le = qobject_cast<QLineEdit*> (widget)) != nullptr) 69 if ((le = qobject_cast<QLineEdit*> (widget)))
70 { 70 {
71 le->setText (value.toString()); 71 le->setText (value.toString());
72 } 72 }
73 else if ((spinbox = qobject_cast<QSpinBox*> (widget)) != nullptr) 73 else if ((spinbox = qobject_cast<QSpinBox*> (widget)))
74 { 74 {
75 spinbox->setValue (value.toInt()); 75 spinbox->setValue (value.toInt());
76 } 76 }
77 else if ((doublespinbox = qobject_cast<QDoubleSpinBox*> (widget)) != nullptr) 77 else if ((doublespinbox = qobject_cast<QDoubleSpinBox*> (widget)))
78 { 78 {
79 doublespinbox->setValue (value.toDouble()); 79 doublespinbox->setValue (value.toDouble());
80 } 80 }
81 else if ((slider = qobject_cast<QSlider*> (widget)) != nullptr) 81 else if ((slider = qobject_cast<QSlider*> (widget)))
82 { 82 {
83 slider->setValue (value.toInt()); 83 slider->setValue (value.toInt());
84 } 84 }
85 else if ((checkbox = qobject_cast<QCheckBox*> (widget)) != nullptr) 85 else if ((checkbox = qobject_cast<QCheckBox*> (widget)))
86 { 86 {
87 checkbox->setChecked (value.toBool()); 87 checkbox->setChecked (value.toBool());
88 } 88 }
89 else if ((button = qobject_cast<QPushButton*> (widget)) != nullptr) 89 else if ((button = qobject_cast<QPushButton*> (widget)))
90 { 90 {
91 setButtonBackground (button, value.toString()); 91 setButtonBackground (button, value.toString());
92 connect (button, SIGNAL (clicked()), this, SLOT (setButtonColor())); 92 connect (button, SIGNAL (clicked()), this, SLOT (setButtonColor()));
93 } 93 }
94 else 94 else
228 QDoubleSpinBox* doublespinbox; 228 QDoubleSpinBox* doublespinbox;
229 QSlider* slider; 229 QSlider* slider;
230 QCheckBox* checkbox; 230 QCheckBox* checkbox;
231 QPushButton* button; 231 QPushButton* button;
232 232
233 if ((le = qobject_cast<QLineEdit*> (widget)) != nullptr) 233 if ((le = qobject_cast<QLineEdit*> (widget)))
234 value = le->text(); 234 value = le->text();
235 else if ((spinbox = qobject_cast<QSpinBox*> (widget)) != nullptr) 235 else if ((spinbox = qobject_cast<QSpinBox*> (widget)))
236 value = spinbox->value(); 236 value = spinbox->value();
237 else if ((doublespinbox = qobject_cast<QDoubleSpinBox*> (widget)) != nullptr) 237 else if ((doublespinbox = qobject_cast<QDoubleSpinBox*> (widget)))
238 value = doublespinbox->value(); 238 value = doublespinbox->value();
239 else if ((slider = qobject_cast<QSlider*> (widget)) != nullptr) 239 else if ((slider = qobject_cast<QSlider*> (widget)))
240 value = slider->value(); 240 value = slider->value();
241 else if ((checkbox = qobject_cast<QCheckBox*> (widget)) != nullptr) 241 else if ((checkbox = qobject_cast<QCheckBox*> (widget)))
242 value = checkbox->isChecked(); 242 value = checkbox->isChecked();
243 else if ((button = qobject_cast<QPushButton*> (widget)) != nullptr) 243 else if ((button = qobject_cast<QPushButton*> (widget)))
244 value = m_buttonColors[button]; 244 value = m_buttonColors[button];
245 else 245 else
246 { 246 {
247 print ("Unknown widget of type %1\n", widget->metaObject()->className()); 247 print ("Unknown widget of type %1\n", widget->metaObject()->className());
248 return; 248 return;
378 LDColor value; 378 LDColor value;
379 379
380 if (not ColorSelector::selectColor (this, value, defaultValue)) 380 if (not ColorSelector::selectColor (this, value, defaultValue))
381 return; 381 return;
382 382
383 if (entry != nullptr) 383 if (entry)
384 { 384 {
385 entry->setColor (value); 385 entry->setColor (value);
386 } 386 }
387 else 387 else
388 { 388 {

mercurial