Update options after move.

--HG--
branch : feature
This commit is contained in:
dismine 2014-08-26 22:34:27 +03:00
parent bdfd292386
commit 70a17f118e
5 changed files with 17 additions and 15 deletions

View File

@ -1981,6 +1981,7 @@ void MainWindow::PropertyBrowser()
toolOptions = new VToolOptionsPropertyBrowser(ui->dockWidgetToolOptions); toolOptions = new VToolOptionsPropertyBrowser(ui->dockWidgetToolOptions);
connect(ui->view, &VMainGraphicsView::itemClicked, toolOptions, &VToolOptionsPropertyBrowser::itemClicked); connect(ui->view, &VMainGraphicsView::itemClicked, toolOptions, &VToolOptionsPropertyBrowser::itemClicked);
connect(doc, &VPattern::FullUpdateFromFile, toolOptions, &VToolOptionsPropertyBrowser::UpdateOptions);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -53,12 +53,6 @@ VToolOptionsPropertyBrowser::VToolOptionsPropertyBrowser(QDockWidget *parent)
scroll->setWidgetResizable(true); scroll->setWidgetResizable(true);
scroll->setWidget(TreeView); scroll->setWidget(TreeView);
// QLayout* layout = parent->layout();
// layout->setSpacing(5);
// layout->setMargin(0);
// layout->addWidget(scroll);
// parent->setLayout(layout);
parent->setWidget(scroll); parent->setWidget(scroll);
connect(PropertyModel, SIGNAL(onDataChangedByEditor(VProperty*)), this, SLOT(userChangedData(VProperty*))); connect(PropertyModel, SIGNAL(onDataChangedByEditor(VProperty*)), this, SLOT(userChangedData(VProperty*)));
@ -67,6 +61,12 @@ VToolOptionsPropertyBrowser::VToolOptionsPropertyBrowser(QDockWidget *parent)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::itemClicked(QGraphicsItem *item) void VToolOptionsPropertyBrowser::itemClicked(QGraphicsItem *item)
{ {
if (currentItem == item)
{
UpdateOptions();
return;
}
QMap<VProperty *, QString>::ConstIterator itProp = propertyToId.constBegin(); QMap<VProperty *, QString>::ConstIterator itProp = propertyToId.constBegin();
while (itProp != propertyToId.constEnd()) while (itProp != propertyToId.constEnd())
{ {

View File

@ -39,7 +39,8 @@ QWidget* VIntegerProperty::createEditor(QWidget * parent, const QStyleOptionView
tmpEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); tmpEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
tmpEditor->setValue(d_ptr->VariantValue.toInt()); tmpEditor->setValue(d_ptr->VariantValue.toInt());
return tmpEditor; d_ptr->editor = tmpEditor;
return d_ptr->editor;
} }
//! Gets the data from the widget //! Gets the data from the widget
@ -126,7 +127,8 @@ QWidget* VDoubleProperty::createEditor(QWidget * parent, const QStyleOptionViewI
tmpEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); tmpEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
tmpEditor->setValue(d_ptr->VariantValue.toDouble()); tmpEditor->setValue(d_ptr->VariantValue.toDouble());
return tmpEditor; d_ptr->editor = tmpEditor;
return d_ptr->editor;
} }
//! Gets the data from the widget //! Gets the data from the widget

View File

@ -86,7 +86,6 @@ QWidget* VProperty::createEditor(QWidget * parent, const QStyleOptionViewItem& o
QItemEditorFactory::setDefaultFactory(factory); QItemEditorFactory::setDefaultFactory(factory);
d_ptr->editor = factory->createEditor(d_ptr->PropertyVariantType, parent); d_ptr->editor = factory->createEditor(d_ptr->PropertyVariantType, parent);
//return factory->createEditor(d_ptr->PropertyVariantType, parent);
return d_ptr->editor; return d_ptr->editor;
} }

View File

@ -103,12 +103,12 @@ int VPropertySet::count() const
void VPropertySet::clear(bool delete_properties) void VPropertySet::clear(bool delete_properties)
{ {
d_ptr->Properties.clear(); d_ptr->Properties.clear();
while(!d_ptr->RootProperties.isEmpty()) { // while(!d_ptr->RootProperties.isEmpty()) {
VProperty* tmpProp = d_ptr->RootProperties.takeLast(); // VProperty* tmpProp = d_ptr->RootProperties.takeLast();
if(tmpProp != NULL && delete_properties) { // if(tmpProp != NULL && delete_properties) {
delete tmpProp; // delete tmpProp;
} // }
} // }
} }
QString VPropertySet::getPropertyID(const VProperty *prop, bool look_for_parent_id) const QString VPropertySet::getPropertyID(const VProperty *prop, bool look_for_parent_id) const