Complete working with the property browser.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2016-12-19 14:18:32 +02:00
parent 947f4eb97c
commit 6f4d1b5ed9
2 changed files with 73 additions and 0 deletions

View File

@ -322,6 +322,9 @@ void VToolOptionsPropertyBrowser::UpdateOptions()
case VToolMove::Type:
UpdateOptionsToolMove();
break;
case VToolEllipticalArc::Type:
UpdateOptionsToolEllipticalArc();
break;
default:
break;
}
@ -460,6 +463,9 @@ void VToolOptionsPropertyBrowser::userChangedData(VProperty *property)
case VToolMove::Type:
ChangeDataToolMove(prop);
break;
case VToolEllipticalArc::Type:
ChangeDataToolEllipticalArc(prop);
break;
default:
break;
}
@ -1728,6 +1734,42 @@ void VToolOptionsPropertyBrowser::ChangeDataToolFlippingByAxis(VProperty *proper
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolEllipticalArc(VProperty *property)
{
SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property];
VToolEllipticalArc *i = qgraphicsitem_cast<VToolEllipticalArc *>(currentItem);
SCASSERT(i != nullptr);
switch (PropertiesList().indexOf(id))
{
case 40://AttrRadius1
i->SetFormulaRadius1(value.value<VFormula>());
break;
case 41://AttrRadius2
i->SetFormulaRadius2(value.value<VFormula>());
break;
case 9://AttrAngle1
i->SetFormulaF1(value.value<VFormula>());
break;
case 10://AttrAngle2
i->SetFormulaF2(value.value<VFormula>());
break;
case 42://AttrRotationAngle
i->SetFormulaRotationAngle(value.value<VFormula>());
break;
case 27://AttrColor
i->SetLineColor(value.toString());
break;
default:
qWarning()<<"Unknown property type. id = "<<id;
break;
}
}
//---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ShowOptionsToolSinglePoint(QGraphicsItem *item)
{
@ -2656,6 +2698,35 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolFlippingByAxis()
idToProperty[AttrSuffix]->setValue(i->Suffix());
}
//---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::UpdateOptionsToolEllipticalArc()
{
VToolEllipticalArc *i = qgraphicsitem_cast<VToolEllipticalArc *>(currentItem);
QVariant valueFormulaRadius1;
valueFormulaRadius1.setValue(i->GetFormulaRadius1());
idToProperty[AttrRadius1]->setValue(valueFormulaRadius1);
QVariant valueFormulaRadius2;
valueFormulaRadius2.setValue(i->GetFormulaRadius2());
idToProperty[AttrRadius2]->setValue(valueFormulaRadius2);
QVariant valueFormulaF1;
valueFormulaF1.setValue(i->GetFormulaF1());
idToProperty[AttrAngle1]->setValue(valueFormulaF1);
QVariant valueFormulaF2;
valueFormulaF2.setValue(i->GetFormulaF2());
idToProperty[AttrAngle2]->setValue(valueFormulaF2);
QVariant valueFormulaRotationAngle;
valueFormulaRotationAngle.setValue(i->GetFormulaRotationAngle());
idToProperty[AttrRotationAngle]->setValue(valueFormulaRotationAngle);
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[AttrColor]->setValue(index);
}
//---------------------------------------------------------------------------------------------------------------------
QStringList VToolOptionsPropertyBrowser::PropertiesList() const
{

View File

@ -161,6 +161,7 @@ private:
void ChangeDataToolMove(VPE::VProperty *property);
void ChangeDataToolFlippingByLine(VPE::VProperty *property);
void ChangeDataToolFlippingByAxis(VPE::VProperty *property);
void ChangeDataToolEllipticalArc(VPE::VProperty *property);
void ShowOptionsToolSinglePoint(QGraphicsItem *item);
void ShowOptionsToolEndLine(QGraphicsItem *item);
@ -230,6 +231,7 @@ private:
void UpdateOptionsToolMove();
void UpdateOptionsToolFlippingByLine();
void UpdateOptionsToolFlippingByAxis();
void UpdateOptionsToolEllipticalArc();
};
#endif // VTOOLOPTIONSPROPERTYBROWSER_H