Skip to content
Snippets Groups Projects
Commit 0eab52e8 authored by pospelov's avatar pospelov
Browse files

MaterialPropertyBrowser bug fix in material property propagation

parent 5de9a8cb
No related branches found
No related tags found
No related merge requests found
......@@ -42,3 +42,9 @@ void MaterialPropertyEdit::buttonClicked()
}
void MaterialPropertyEdit::setMaterialProperty(const MaterialProperty &materialProperty)
{
m_materialProperty = materialProperty;
m_textLabel->setText(m_materialProperty.getName());
m_pixmapLabel->setPixmap(m_materialProperty.getPixmap());
}
......@@ -13,7 +13,7 @@ class MaterialPropertyEdit : public QWidget
public:
MaterialPropertyEdit(QWidget *parent = 0);
void setMaterialProperty(const MaterialProperty &materialProperty) { m_materialProperty = materialProperty; }
void setMaterialProperty(const MaterialProperty &materialProperty);
MaterialProperty getMaterialProperty() const {return m_materialProperty; }
signals:
void materialPropertyChanged(const MaterialProperty &material);
......
......@@ -27,6 +27,9 @@ QWidget *PropertyVariantFactory::createEditor(QtVariantPropertyManager *manager,
{
if (manager->propertyType(property) == PropertyVariantManager::materialTypeId()) {
MaterialPropertyEdit *editor = new MaterialPropertyEdit(parent);
// QVariant var = manager->value(property);
// MaterialProperty mat = var.value<MaterialProperty>();
// editor->setMaterialProperty(mat);
// editor->setFilePath(manager->value(property).toString());
// editor->setFilter(manager->attributeValue(property, QLatin1String("filter")).toString());
......@@ -60,9 +63,10 @@ void PropertyVariantFactory::disconnectPropertyManager(QtVariantPropertyManager
void PropertyVariantFactory::slotPropertyChanged(QtProperty *property,
const QVariant &value)
{
std::cout << "PropertyVariantFactory::slotPropertyChanged() ->" << std::endl;
std::cout << "PropertyVariantFactory::slotPropertyChanged() ->v1.1" << std::endl;
if (!theCreatedEditors.contains(property))
return;
std::cout << "PropertyVariantFactory::slotPropertyChanged() ->v1.2" << std::endl;
QList<MaterialPropertyEdit *> editors = theCreatedEditors[property];
QListIterator<MaterialPropertyEdit *> itEditor(editors);
......@@ -70,6 +74,7 @@ void PropertyVariantFactory::slotPropertyChanged(QtProperty *property,
// itEditor.next()->setFilePath(value.toString());
while (itEditor.hasNext()) {
MaterialProperty mat = value.value<MaterialProperty>();
std::cout << "PropertyVariantFactory::slotPropertyChanged() ->v1.3" << mat.getName().toStdString()<< std::endl;
itEditor.next()->setMaterialProperty(mat);
}
}
......
......@@ -50,7 +50,7 @@ QVariant PropertyVariantManager::value(const QtProperty *property) const
if (theValues.contains(property)) {
QVariant v;
v.setValue(theValues[property]);
std::cout << "PropertyVariantManager::value() -> " << std::endl;
std::cout << "PropertyVariantManager::value() -> " << theValues[property].getName().toStdString() << std::endl;
return v;
}
// return theValues[property].value;
......@@ -123,8 +123,8 @@ void PropertyVariantManager::setValue(QtProperty *property, const QVariant &val)
// return;
std::cout << "ObjectVariantManager::setValue() -> XXX 1.2" << std::endl;
if( val.userType() != materialTypeId() ) return;
std::cout << "ObjectVariantManager::setValue() -> XXX 1.3" << std::endl;
MaterialProperty mat = val.value<MaterialProperty>();
std::cout << "ObjectVariantManager::setValue() -> XXX 1.3 " << mat.getName().toStdString()<< std::endl;
theValues[property] = mat;
QVariant v2;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment