Material: Problems editing Quantity properties
There were several issues here, not just one. The following are fixed: Incorrect display of Quantity items (NaN) Editing and updating quantity items Editing and updating items on the first row. There are still issues with editing lists, but these were known issues at the time of initial merge. This has been split out into issue #13435 fixes #13020
This commit is contained in:
committed by
Chris Hennes
parent
6e55cd1c3a
commit
b331a9f7a2
@@ -43,7 +43,6 @@
|
||||
#include <Gui/PrefWidgets.h>
|
||||
#include <Gui/SpinBox.h>
|
||||
#include <Gui/WaitCursor.h>
|
||||
// #include <Gui/FileDialog.h>
|
||||
|
||||
#include <Mod/Material/App/Exceptions.h>
|
||||
#include <Mod/Material/App/ModelManager.h>
|
||||
@@ -331,8 +330,9 @@ void BaseDelegate::setEditorData(QWidget* editor, const QModelIndex& index) cons
|
||||
return;
|
||||
}
|
||||
if (type == Materials::MaterialValue::Quantity) {
|
||||
auto input = dynamic_cast<Gui::InputField*>(editor);
|
||||
input->setQuantityString(item.toString());
|
||||
auto input = dynamic_cast<Gui::QuantitySpinBox*>(editor);
|
||||
// input->setQuantityString(item.toString());
|
||||
input->setValue(item.value<Base::Quantity>());
|
||||
return;
|
||||
}
|
||||
if (type == Materials::MaterialValue::List || type == Materials::MaterialValue::ImageList) {
|
||||
@@ -354,10 +354,11 @@ void BaseDelegate::setModelData(QWidget* editor,
|
||||
value = chooser->fileName();
|
||||
}
|
||||
else if (type == Materials::MaterialValue::Quantity) {
|
||||
auto input = dynamic_cast<Gui::InputField*>(editor);
|
||||
auto input = dynamic_cast<Gui::QuantitySpinBox*>(editor);
|
||||
// value = input->text();
|
||||
// return;
|
||||
auto quantity = Base::Quantity::parse(input->text());
|
||||
// auto quantity = Base::Quantity::parse(input->text());
|
||||
auto quantity = input->value();
|
||||
value = QVariant::fromValue(quantity);
|
||||
}
|
||||
else if (type == Materials::MaterialValue::Integer) {
|
||||
@@ -383,6 +384,7 @@ void BaseDelegate::setModelData(QWidget* editor,
|
||||
}
|
||||
|
||||
setValue(model, index, value);
|
||||
// Q_EMIT model->dataChanged(index, index);
|
||||
}
|
||||
|
||||
QWidget* BaseDelegate::createEditor(QWidget* parent,
|
||||
|
||||
Reference in New Issue
Block a user