+ fixes #0001941: Refresh Property Editor
This commit is contained in:
parent
043dc1616d
commit
9f5283d001
|
@ -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
|
||||
|
@ -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()));
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@ public:
|
|||
|
||||
/** 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();
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user