Skip to content

Commit

Permalink
+ fixes #1941: Refresh Property Editor
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Sep 13, 2015
1 parent 043dc16 commit 9f5283d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Gui/propertyeditor/PropertyItem.cpp
Expand Up @@ -81,15 +81,20 @@ void PropertyItem::reset()
void PropertyItem::setPropertyData(const std::vector<App::Property*>& items)
{
propertyItems = items;
updateData();
this->initialize();
}

void PropertyItem::updateData()
{
bool ro = true;
for (std::vector<App::Property*>::const_iterator it = items.begin();
it != items.end(); ++it) {
for (std::vector<App::Property*>::const_iterator it = propertyItems.begin();
it != propertyItems.end(); ++it) {
App::PropertyContainer* parent = (*it)->getContainer();
if (parent)
ro &= (parent->isReadOnly(*it) || (*it)->StatusBits.test(2));
}
this->setReadOnly(ro);
this->initialize();
}

const std::vector<App::Property*>& PropertyItem::getPropertyData() const
Expand Down Expand Up @@ -1774,6 +1779,7 @@ void PropertyEnumItem::setEditorData(QWidget *editor, const QVariant& data) cons

QComboBox *cb = qobject_cast<QComboBox*>(editor);
if (!commonModes.isEmpty()) {
cb->clear();
cb->addItems(commonModes);
cb->setCurrentIndex(cb->findText(data.toString()));
}
Expand Down
1 change: 1 addition & 0 deletions src/Gui/propertyeditor/PropertyItem.h
Expand Up @@ -60,6 +60,7 @@ class GuiExport PropertyItem : virtual public QObject, public Base::BaseClass

/** Sets the current property objects. */
void setPropertyData( const std::vector<App::Property*>& );
void updateData();
const std::vector<App::Property*>& getPropertyData() const;
bool hasProperty(const App::Property*) const;
App::Property* getFirstProperty();
Expand Down
1 change: 1 addition & 0 deletions src/Gui/propertyeditor/PropertyModel.cpp
Expand Up @@ -268,6 +268,7 @@ void PropertyModel::updateProperty(const App::Property& prop)
for (int row=0; row<numChild; row++) {
PropertyItem* child = rootItem->child(row);
if (child->hasProperty(&prop)) {
child->updateData();
QModelIndex data = this->index(row, column, QModelIndex());
if (data.isValid()) {
dataChanged(data, data);
Expand Down

0 comments on commit 9f5283d

Please sign in to comment.