git-svn-id: svn://db.shs.com.ru/libs@117 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2016-08-16 13:15:29 +00:00
parent 91f4f74df4
commit 39d406d6aa
12 changed files with 204 additions and 56 deletions

View File

@@ -192,6 +192,7 @@ void QVariantEdit::_recreate(const QVariant & new_value) {
switch (new_value.type()) {
case QVariant::Bool:
_check = new QCheckBox(this);
_check->setAutoFillBackground(true);
_cur_edit = _check;
connect(_check, SIGNAL(toggled(bool)), this, SLOT(_changed()));
break;
@@ -225,7 +226,7 @@ void QVariantEdit::_recreate(const QVariant & new_value) {
break;
case QVariant::Double:
_spin = new QDoubleSpinBox(this);
_spin->setDecimals(3);
_spin->setDecimals(5);
_spin->setRange(-1E+199, 1E+199);
_cur_edit = _spin;
connect(_spin, SIGNAL(valueChanged(double)), this, SLOT(_changed()));
@@ -289,7 +290,7 @@ void QVariantEdit::_recreate(const QVariant & new_value) {
}
if (!_cur_edit) {
if (new_value.canConvert<QVariantEdit::EnumType>()) {
_enum = new QComboBox(this);
_enum = new EComboBox(this);
_setEnum(new_value.value<QVariantEdit::EnumType>());
_cur_edit = _enum;
connect(_enum, SIGNAL(currentIndexChanged(int)), this, SLOT(_changed()));
@@ -368,7 +369,7 @@ void QVariantEdit::setValue(const QVariant & v) {
_recreate(v);
if (_cur_edit) _cur_edit->blockSignals(true);
if (_line) {_line->setText(v.toString());}
if (_check) {_check->setChecked(v.toBool());}
if (_check) {_check->setChecked(v.toBool()); _check->setText(v.toBool() ? "true" : "false");}
if (_color) {_color->setColor(v.value<QColor>());}
if (_list) {_list->setValue(v.toStringList());}
if (_date) {_date->setDateTime(v.toDateTime());}
@@ -441,3 +442,8 @@ void QVariantEdit::_setDir(const DirType & v) {
_path->is_abs = v.is_abs;
}
void QVariantEdit::_changed() {
if (_check) _check->setText(_check->isChecked() ? "true" : "false");
emit valueChanged(value());
}