void FloatProperty::textEdited() { float newValue = _lineEdit->text().toFloat(); if (newValue != _value) { if (!_setter(newValue)) _lineEdit->setText(QString::number(_value)); else _value = newValue; } }
void StringProperty::textEdited() { std::string value = _lineEdit->text().toStdString(); if (value != _value) { if (!_setter(value)) _lineEdit->setText(QString::fromStdString(_value)); else _value = value; } }
void VectorProperty::changeRgb() { Vec3f color; for (int i = 0; i < 3; ++i) color[i] = _lineEdits[i]->text().toFloat(); if (_setter(color)) { _value = color; _colorPicker->changeColor(_isAbsorption ? std::exp(-color) : color); } }
void ListProperty::changeActive(int idx) { if (idx == _index) return; if (_setter(_list[idx], idx)) { _index = idx; _value = _list[idx]; } else { _comboBox->setCurrentIndex(_index); } }
void VectorProperty::changeRgb(Vec3f color) { if (_isAbsorption) color = -std::log(color); if (_setter(color)) { _value = color; for (int i = 0; i < 3; ++i) { setText(_lineEdits[i], QString::number(color[i])); } } }
bool DataProperty::setValue(DataObject* obj, const DataValue& value) const { return _setter && _setter(obj, const_cast<DataProperty*>(this), DataValue(value).convertTo(_type)); }
bool CProperty::Set(const string &value) const { return _setter(value); }