Property explorer now show color combobox.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2015-02-07 16:42:49 +02:00
parent 6d638a3080
commit 619a303e9b
6 changed files with 156 additions and 2 deletions

View File

@ -60,7 +60,7 @@ public:
virtual void SetTypeLine(const QString &value); virtual void SetTypeLine(const QString &value);
QString GetLineColor() const; QString GetLineColor() const;
void SetLineColor(const QString &value); virtual void SetLineColor(const QString &value);
public slots: public slots:
virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable); virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable);

View File

@ -462,6 +462,15 @@ void VToolLine::SetTypeLine(const QString &value)
SaveOption(obj); SaveOption(obj);
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolLine::SetLineColor(const QString &value)
{
lineColor = value;
QSharedPointer<VGObject> obj;//We don't have object for line in data container. Just will send empty object.
SaveOption(obj);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
quint32 VToolLine::GetFirstPoint() const quint32 VToolLine::GetFirstPoint() const
{ {

View File

@ -59,7 +59,9 @@ public:
void SetSecondPoint(const quint32 &value); void SetSecondPoint(const quint32 &value);
virtual void ShowVisualization(bool show); virtual void ShowVisualization(bool show);
virtual void SetTypeLine(const QString &value); virtual void SetTypeLine(const QString &value);
virtual void SetLineColor(const QString &value);
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void ChangedActivDraw(const QString &newName); virtual void ChangedActivDraw(const QString &newName);

View File

@ -396,6 +396,22 @@ void VToolOptionsPropertyBrowser::AddPropertyLineType(Tool *i, const QString &pr
AddProperty(lineTypeProperty, VAbstractTool::AttrTypeLine); AddProperty(lineTypeProperty, VAbstractTool::AttrTypeLine);
} }
//---------------------------------------------------------------------------------------------------------------------
template<class Tool>
void VToolOptionsPropertyBrowser::AddPropertyLineColor(Tool *i, const QString &propertyName,
const QMap<QString, QString> &colors, const QString &id)
{
VLineColorProperty *lineColorProperty = new VLineColorProperty(propertyName);
lineColorProperty->setColors(colors);
const qint32 index = VLineColorProperty::IndexOfColor(colors, i->GetLineColor());
if (index == -1)
{
qWarning()<<"Can't find line style" << i->GetLineColor()<<"in list";
}
lineColorProperty->setValue(index);
AddProperty(lineColorProperty, id);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
template<class Tool> template<class Tool>
void VToolOptionsPropertyBrowser::SetPointName(const QString &name) void VToolOptionsPropertyBrowser::SetPointName(const QString &name)
@ -471,6 +487,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolEndLine(VProperty *property)
case 3: // VAbstractTool::AttrTypeLine case 3: // VAbstractTool::AttrTypeLine
i->SetTypeLine(value.toString()); i->SetTypeLine(value.toString());
break; break;
case 26: // VAbstractTool::AttrTypeLineColor
i->SetLineColor(value.toString());
break;
case 4: // VAbstractTool::AttrLength case 4: // VAbstractTool::AttrLength
i->SetFormulaLength(value.value<VFormula>()); i->SetFormulaLength(value.value<VFormula>());
break; break;
@ -501,6 +520,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolAlongLine(VProperty *property)
case 3: // VAbstractTool::AttrTypeLine case 3: // VAbstractTool::AttrTypeLine
i->SetTypeLine(value.toString()); i->SetTypeLine(value.toString());
break; break;
case 26: // VAbstractTool::AttrTypeLineColor
i->SetLineColor(value.toString());
break;
case 4: // VAbstractTool::AttrLength case 4: // VAbstractTool::AttrLength
i->SetFormulaLength(value.value<VFormula>()); i->SetFormulaLength(value.value<VFormula>());
break; break;
@ -531,6 +553,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolArc(VProperty *property)
case 10: // VAbstractTool::AttrAngle2 case 10: // VAbstractTool::AttrAngle2
i->SetFormulaF2(value.value<VFormula>()); i->SetFormulaF2(value.value<VFormula>());
break; break;
case 27: // VAbstractTool::AttrTypeColor
i->SetLineColor(value.toString());
break;
default: default:
qWarning()<<"Unknown property type. id = "<<id; qWarning()<<"Unknown property type. id = "<<id;
break; break;
@ -558,6 +583,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolBisector(VProperty *property)
case 3: // VAbstractTool::AttrTypeLine case 3: // VAbstractTool::AttrTypeLine
i->SetTypeLine(value.toString()); i->SetTypeLine(value.toString());
break; break;
case 26: // VAbstractTool::AttrTypeLineColor
i->SetLineColor(value.toString());
break;
default: default:
qWarning()<<"Unknown property type. id = "<<id; qWarning()<<"Unknown property type. id = "<<id;
break; break;
@ -654,6 +682,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolHeight(VProperty *property)
case 3: // VAbstractTool::AttrTypeLine case 3: // VAbstractTool::AttrTypeLine
i->SetTypeLine(value.toString()); i->SetTypeLine(value.toString());
break; break;
case 26: // VAbstractTool::AttrTypeLineColor
i->SetLineColor(value.toString());
break;
default: default:
qWarning()<<"Unknown property type. id = "<<id; qWarning()<<"Unknown property type. id = "<<id;
break; break;
@ -675,6 +706,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolLine(VProperty *property)
case 3: // VAbstractTool::AttrTypeLine case 3: // VAbstractTool::AttrTypeLine
i->SetTypeLine(value.toString()); i->SetTypeLine(value.toString());
break; break;
case 26: // VAbstractTool::AttrTypeLineColor
i->SetLineColor(value.toString());
break;
default: default:
qWarning()<<"Unknown property type. id = "<<id; qWarning()<<"Unknown property type. id = "<<id;
break; break;
@ -724,6 +758,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolNormal(VProperty *property)
case 3: // VAbstractTool::AttrTypeLine case 3: // VAbstractTool::AttrTypeLine
i->SetTypeLine(value.toString()); i->SetTypeLine(value.toString());
break; break;
case 26: // VAbstractTool::AttrTypeLineColor
i->SetLineColor(value.toString());
break;
default: default:
qWarning()<<"Unknown property type. id = "<<id; qWarning()<<"Unknown property type. id = "<<id;
break; break;
@ -794,6 +831,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolShoulderPoint(VProperty *propert
case 3: // VAbstractTool::AttrTypeLine case 3: // VAbstractTool::AttrTypeLine
i->SetTypeLine(value.toString()); i->SetTypeLine(value.toString());
break; break;
case 26: // VAbstractTool::AttrTypeLineColor
i->SetLineColor(value.toString());
break;
default: default:
qWarning()<<"Unknown property type. id = "<<id; qWarning()<<"Unknown property type. id = "<<id;
break; break;
@ -819,6 +859,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolSpline(VProperty *property)
i->setSpline(spl); i->setSpline(spl);
break; break;
} }
case 27: // VAbstractTool::AttrTypeColor
i->SetLineColor(value.toString());
break;
default: default:
qWarning()<<"Unknown property type. id = "<<id; qWarning()<<"Unknown property type. id = "<<id;
break; break;
@ -844,6 +887,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolSplinePath(VProperty *property)
i->setSplinePath(splPath); i->setSplinePath(splPath);
break; break;
} }
case 27: // VAbstractTool::AttrTypeColor
i->SetLineColor(value.toString());
break;
default: default:
qWarning()<<"Unknown property type. id = "<<id; qWarning()<<"Unknown property type. id = "<<id;
break; break;
@ -887,6 +933,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolLineIntersectAxis(VProperty *pro
case 3: // VAbstractTool::AttrTypeLine case 3: // VAbstractTool::AttrTypeLine
i->SetTypeLine(value.toString()); i->SetTypeLine(value.toString());
break; break;
case 26: // VAbstractTool::AttrTypeLineColor
i->SetLineColor(value.toString());
break;
case 5: // VAbstractTool::AttrAngle case 5: // VAbstractTool::AttrAngle
i->SetFormulaAngle(value.value<VFormula>()); i->SetFormulaAngle(value.value<VFormula>());
break; break;
@ -914,6 +963,9 @@ void VToolOptionsPropertyBrowser::ChangeDataToolCurveIntersectAxis(VProperty *pr
case 3: // VAbstractTool::AttrTypeLine case 3: // VAbstractTool::AttrTypeLine
i->SetTypeLine(value.toString()); i->SetTypeLine(value.toString());
break; break;
case 26: // VAbstractTool::AttrTypeLineColor
i->SetLineColor(value.toString());
break;
case 5: // VAbstractTool::AttrAngle case 5: // VAbstractTool::AttrAngle
i->SetFormulaAngle(value.value<VFormula>()); i->SetFormulaAngle(value.value<VFormula>());
break; break;
@ -946,6 +998,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolEndLine(QGraphicsItem *item)
AddPropertyPointName(i, tr("Point label")); AddPropertyPointName(i, tr("Point label"));
AddPropertyLineType(i, tr("Line type"), VAbstractTool::LineStylesPics()); AddPropertyLineType(i, tr("Line type"), VAbstractTool::LineStylesPics());
AddPropertyLineColor(i, tr("Line color"), VAbstractTool::ColorsList(), VAbstractTool::AttrLineColor);
AddPropertyFormula(tr("Length"), i->GetFormulaLength(), VAbstractTool::AttrLength); AddPropertyFormula(tr("Length"), i->GetFormulaLength(), VAbstractTool::AttrLength);
AddPropertyFormula(tr("Angle"), i->GetFormulaAngle(), VAbstractTool::AttrAngle); AddPropertyFormula(tr("Angle"), i->GetFormulaAngle(), VAbstractTool::AttrAngle);
} }
@ -959,6 +1012,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolAlongLine(QGraphicsItem *item)
AddPropertyPointName(i, tr("Point label")); AddPropertyPointName(i, tr("Point label"));
AddPropertyLineType(i, tr("Line type"), VAbstractTool::LineStylesPics()); AddPropertyLineType(i, tr("Line type"), VAbstractTool::LineStylesPics());
AddPropertyLineColor(i, tr("Line color"), VAbstractTool::ColorsList(), VAbstractTool::AttrLineColor);
AddPropertyFormula(tr("Length"), i->GetFormulaLength(), VAbstractTool::AttrLength); AddPropertyFormula(tr("Length"), i->GetFormulaLength(), VAbstractTool::AttrLength);
} }
@ -972,6 +1026,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolArc(QGraphicsItem *item)
AddPropertyFormula(tr("Radius"), i->GetFormulaRadius(), VAbstractTool::AttrRadius); AddPropertyFormula(tr("Radius"), i->GetFormulaRadius(), VAbstractTool::AttrRadius);
AddPropertyFormula(tr("First angle"), i->GetFormulaF1(), VAbstractTool::AttrAngle1); AddPropertyFormula(tr("First angle"), i->GetFormulaF1(), VAbstractTool::AttrAngle1);
AddPropertyFormula(tr("Second angle"), i->GetFormulaF2(), VAbstractTool::AttrAngle2); AddPropertyFormula(tr("Second angle"), i->GetFormulaF2(), VAbstractTool::AttrAngle2);
AddPropertyLineColor(i, tr("Color"), VAbstractTool::ColorsList(), VAbstractTool::AttrColor);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -983,6 +1038,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolBisector(QGraphicsItem *item)
AddPropertyPointName(i, tr("Point label")); AddPropertyPointName(i, tr("Point label"));
AddPropertyLineType(i, tr("Line type"), VAbstractTool::LineStylesPics()); AddPropertyLineType(i, tr("Line type"), VAbstractTool::LineStylesPics());
AddPropertyLineColor(i, tr("Line color"), VAbstractTool::ColorsList(), VAbstractTool::AttrLineColor);
AddPropertyFormula(tr("Length"), i->GetFormulaLength(), VAbstractTool::AttrLength); AddPropertyFormula(tr("Length"), i->GetFormulaLength(), VAbstractTool::AttrLength);
} }
@ -1028,6 +1084,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolHeight(QGraphicsItem *item)
AddPropertyPointName(i, tr("Point label")); AddPropertyPointName(i, tr("Point label"));
AddPropertyLineType(i, tr("Line type"), VAbstractTool::LineStylesPics()); AddPropertyLineType(i, tr("Line type"), VAbstractTool::LineStylesPics());
AddPropertyLineColor(i, tr("Line color"), VAbstractTool::ColorsList(), VAbstractTool::AttrLineColor);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -1040,6 +1097,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolLine(QGraphicsItem *item)
QMap<QString, QIcon> styles = VAbstractTool::LineStylesPics(); QMap<QString, QIcon> styles = VAbstractTool::LineStylesPics();
styles.remove(VAbstractTool::TypeLineNone); styles.remove(VAbstractTool::TypeLineNone);
AddPropertyLineType(i, tr("Line type"), styles); AddPropertyLineType(i, tr("Line type"), styles);
AddPropertyLineColor(i, tr("Line color"), VAbstractTool::ColorsList(), VAbstractTool::AttrLineColor);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -1062,6 +1120,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolNormal(QGraphicsItem *item)
AddPropertyFormula(tr("Length"), i->GetFormulaLength(), VAbstractTool::AttrLength); AddPropertyFormula(tr("Length"), i->GetFormulaLength(), VAbstractTool::AttrLength);
AddPropertyPointName(i, tr("Point label")); AddPropertyPointName(i, tr("Point label"));
AddPropertyLineType(i, tr("Line type"), VAbstractTool::LineStylesPics()); AddPropertyLineType(i, tr("Line type"), VAbstractTool::LineStylesPics());
AddPropertyLineColor(i, tr("Line color"), VAbstractTool::ColorsList(), VAbstractTool::AttrLineColor);
VDoubleProperty* itemAngle = new VDoubleProperty(tr("Additional angle degrees")); VDoubleProperty* itemAngle = new VDoubleProperty(tr("Additional angle degrees"));
itemAngle->setValue(i->GetAngle()); itemAngle->setValue(i->GetAngle());
@ -1101,6 +1160,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolShoulderPoint(QGraphicsItem *it
AddPropertyPointName(i, tr("Point label")); AddPropertyPointName(i, tr("Point label"));
AddPropertyLineType(i, tr("Line type"), VAbstractTool::LineStylesPics()); AddPropertyLineType(i, tr("Line type"), VAbstractTool::LineStylesPics());
AddPropertyLineColor(i, tr("Line color"), VAbstractTool::ColorsList(), VAbstractTool::AttrLineColor);
AddPropertyFormula(tr("Length"), i->GetFormulaLength(), VAbstractTool::AttrLength); AddPropertyFormula(tr("Length"), i->GetFormulaLength(), VAbstractTool::AttrLength);
} }
@ -1119,6 +1179,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSpline(QGraphicsItem *item)
itemFactor->setSetting("Precision", 3); itemFactor->setSetting("Precision", 3);
itemFactor->setValue(spl.GetKcurve()); itemFactor->setValue(spl.GetKcurve());
AddProperty(itemFactor, VAbstractTool::AttrKCurve); AddProperty(itemFactor, VAbstractTool::AttrKCurve);
AddPropertyLineColor(i, tr("Color"), VAbstractTool::ColorsList(), VAbstractTool::AttrColor);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -1136,6 +1197,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSplinePath(QGraphicsItem *item)
itemFactor->setSetting("Precision", 3); itemFactor->setSetting("Precision", 3);
itemFactor->setValue(splPath.GetKCurve()); itemFactor->setValue(splPath.GetKCurve());
AddProperty(itemFactor, VAbstractTool::AttrKCurve); AddProperty(itemFactor, VAbstractTool::AttrKCurve);
AddPropertyLineColor(i, tr("Color"), VAbstractTool::ColorsList(), VAbstractTool::AttrColor);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -1157,6 +1219,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolLineIntersectAxis(QGraphicsItem
AddPropertyPointName(i, tr("Point label")); AddPropertyPointName(i, tr("Point label"));
AddPropertyLineType(i, tr("Line type"), VAbstractTool::LineStylesPics()); AddPropertyLineType(i, tr("Line type"), VAbstractTool::LineStylesPics());
AddPropertyLineColor(i, tr("Line color"), VAbstractTool::ColorsList(), VAbstractTool::AttrLineColor);
AddPropertyFormula(tr("Angle"), i->GetFormulaAngle(), VAbstractTool::AttrAngle); AddPropertyFormula(tr("Angle"), i->GetFormulaAngle(), VAbstractTool::AttrAngle);
} }
@ -1169,6 +1232,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCurveIntersectAxis(QGraphicsIte
AddPropertyPointName(i, tr("Point label")); AddPropertyPointName(i, tr("Point label"));
AddPropertyLineType(i, tr("Line type"), VAbstractTool::LineStylesPics()); AddPropertyLineType(i, tr("Line type"), VAbstractTool::LineStylesPics());
AddPropertyLineColor(i, tr("Line color"), VAbstractTool::ColorsList(), VAbstractTool::AttrLineColor);
AddPropertyFormula(tr("Angle"), i->GetFormulaAngle(), VAbstractTool::AttrAngle); AddPropertyFormula(tr("Angle"), i->GetFormulaAngle(), VAbstractTool::AttrAngle);
} }
@ -1186,8 +1250,15 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolEndLine()
VToolEndLine *i = qgraphicsitem_cast<VToolEndLine *>(currentItem); VToolEndLine *i = qgraphicsitem_cast<VToolEndLine *>(currentItem);
idToProperty[VAbstractTool::AttrName]->setValue(i->name()); idToProperty[VAbstractTool::AttrName]->setValue(i->name());
{
const qint32 index = VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType()); const qint32 index = VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType());
idToProperty[VAbstractTool::AttrTypeLine]->setValue(index); idToProperty[VAbstractTool::AttrTypeLine]->setValue(index);
}
{
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[VAbstractTool::AttrLineColor]->setValue(index);
}
QVariant valueFormula; QVariant valueFormula;
valueFormula.setValue(i->GetFormulaLength()); valueFormula.setValue(i->GetFormulaLength());
@ -1204,8 +1275,15 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolAlongLine()
VToolAlongLine *i = qgraphicsitem_cast<VToolAlongLine *>(currentItem); VToolAlongLine *i = qgraphicsitem_cast<VToolAlongLine *>(currentItem);
idToProperty[VAbstractTool::AttrName]->setValue(i->name()); idToProperty[VAbstractTool::AttrName]->setValue(i->name());
{
const qint32 index = VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType()); const qint32 index = VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType());
idToProperty[VAbstractTool::AttrTypeLine]->setValue(index); idToProperty[VAbstractTool::AttrTypeLine]->setValue(index);
}
{
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[VAbstractTool::AttrLineColor]->setValue(index);
}
QVariant valueFormula; QVariant valueFormula;
valueFormula.setValue(i->GetFormulaLength()); valueFormula.setValue(i->GetFormulaLength());
@ -1229,6 +1307,9 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolArc()
QVariant valueSecondAngle; QVariant valueSecondAngle;
valueSecondAngle.setValue(i->GetFormulaF2()); valueSecondAngle.setValue(i->GetFormulaF2());
idToProperty[VAbstractTool::AttrAngle2]->setValue(valueSecondAngle); idToProperty[VAbstractTool::AttrAngle2]->setValue(valueSecondAngle);
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[VAbstractTool::AttrColor]->setValue(index);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -1242,10 +1323,17 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolBisector()
valueFormula.setValue(i->GetFormulaLength()); valueFormula.setValue(i->GetFormulaLength());
idToProperty[VAbstractTool::AttrLength]->setValue(valueFormula); idToProperty[VAbstractTool::AttrLength]->setValue(valueFormula);
{
const qint32 index = VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType()); const qint32 index = VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType());
idToProperty[VAbstractTool::AttrTypeLine]->setValue(index); idToProperty[VAbstractTool::AttrTypeLine]->setValue(index);
} }
{
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[VAbstractTool::AttrLineColor]->setValue(index);
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::UpdateOptionsToolCutArc() void VToolOptionsPropertyBrowser::UpdateOptionsToolCutArc()
{ {
@ -1289,19 +1377,33 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolHeight()
idToProperty[VAbstractTool::AttrName]->setValue(i->name()); idToProperty[VAbstractTool::AttrName]->setValue(i->name());
{
const qint32 index = VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType()); const qint32 index = VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType());
idToProperty[VAbstractTool::AttrTypeLine]->setValue(index); idToProperty[VAbstractTool::AttrTypeLine]->setValue(index);
} }
{
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[VAbstractTool::AttrLineColor]->setValue(index);
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::UpdateOptionsToolLine() void VToolOptionsPropertyBrowser::UpdateOptionsToolLine()
{ {
VToolLine *i = qgraphicsitem_cast<VToolLine *>(currentItem); VToolLine *i = qgraphicsitem_cast<VToolLine *>(currentItem);
{
const qint32 index = VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType()); const qint32 index = VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType());
idToProperty[VAbstractTool::AttrTypeLine]->setValue(index); idToProperty[VAbstractTool::AttrTypeLine]->setValue(index);
} }
{
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[VAbstractTool::AttrLineColor]->setValue(index);
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::UpdateOptionsToolLineIntersect() void VToolOptionsPropertyBrowser::UpdateOptionsToolLineIntersect()
{ {
@ -1323,10 +1425,17 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolNormal()
idToProperty[VAbstractTool::AttrAngle]->setValue( i->GetAngle()); idToProperty[VAbstractTool::AttrAngle]->setValue( i->GetAngle());
{
const qint32 index = VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType()); const qint32 index = VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType());
idToProperty[VAbstractTool::AttrTypeLine]->setValue(index); idToProperty[VAbstractTool::AttrTypeLine]->setValue(index);
} }
{
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[VAbstractTool::AttrLineColor]->setValue(index);
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::UpdateOptionsToolPointOfContact() void VToolOptionsPropertyBrowser::UpdateOptionsToolPointOfContact()
{ {
@ -1358,10 +1467,17 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolShoulderPoint()
idToProperty[VAbstractTool::AttrName]->setValue(i->name()); idToProperty[VAbstractTool::AttrName]->setValue(i->name());
{
const qint32 index = VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType()); const qint32 index = VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType());
idToProperty[VAbstractTool::AttrTypeLine]->setValue(index); idToProperty[VAbstractTool::AttrTypeLine]->setValue(index);
} }
{
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[VAbstractTool::AttrLineColor]->setValue(index);
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline() void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline()
{ {
@ -1369,6 +1485,9 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline()
VSpline spl = i->getSpline(); VSpline spl = i->getSpline();
idToProperty[VAbstractTool::AttrKCurve]->setValue(spl.GetKcurve()); idToProperty[VAbstractTool::AttrKCurve]->setValue(spl.GetKcurve());
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[VAbstractTool::AttrColor]->setValue(index);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -1378,6 +1497,9 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSplinePath()
VSplinePath splPath = i->getSplinePath(); VSplinePath splPath = i->getSplinePath();
idToProperty[VAbstractTool::AttrKCurve]->setValue(splPath.GetKCurve()); idToProperty[VAbstractTool::AttrKCurve]->setValue(splPath.GetKCurve());
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[VAbstractTool::AttrColor]->setValue(index);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -1394,8 +1516,15 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolLineIntersectAxis()
VToolLineIntersectAxis *i = qgraphicsitem_cast<VToolLineIntersectAxis *>(currentItem); VToolLineIntersectAxis *i = qgraphicsitem_cast<VToolLineIntersectAxis *>(currentItem);
idToProperty[VAbstractTool::AttrName]->setValue(i->name()); idToProperty[VAbstractTool::AttrName]->setValue(i->name());
{
const qint32 index = VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType()); const qint32 index = VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType());
idToProperty[VAbstractTool::AttrTypeLine]->setValue(index); idToProperty[VAbstractTool::AttrTypeLine]->setValue(index);
}
{
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[VAbstractTool::AttrLineColor]->setValue(index);
}
QVariant valueAngle; QVariant valueAngle;
valueAngle.setValue(i->GetFormulaAngle()); valueAngle.setValue(i->GetFormulaAngle());
@ -1408,8 +1537,15 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCurveIntersectAxis()
VToolCurveIntersectAxis *i = qgraphicsitem_cast<VToolCurveIntersectAxis *>(currentItem); VToolCurveIntersectAxis *i = qgraphicsitem_cast<VToolCurveIntersectAxis *>(currentItem);
idToProperty[VAbstractTool::AttrName]->setValue(i->name()); idToProperty[VAbstractTool::AttrName]->setValue(i->name());
{
const qint32 index = VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType()); const qint32 index = VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType());
idToProperty[VAbstractTool::AttrTypeLine]->setValue(index); idToProperty[VAbstractTool::AttrTypeLine]->setValue(index);
}
{
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[VAbstractTool::AttrLineColor]->setValue(index);
}
QVariant valueAngle; QVariant valueAngle;
valueAngle.setValue(i->GetFormulaAngle()); valueAngle.setValue(i->GetFormulaAngle());
@ -1444,6 +1580,8 @@ QStringList VToolOptionsPropertyBrowser::PropertiesList() const
<< VAbstractTool::AttrPShoulder /* 22 */ << VAbstractTool::AttrPShoulder /* 22 */
<< VAbstractTool::AttrAxisP1 /* 23 */ << VAbstractTool::AttrAxisP1 /* 23 */
<< VAbstractTool::AttrAxisP2 /* 24 */ << VAbstractTool::AttrAxisP2 /* 24 */
<< VAbstractTool::AttrKCurve; /* 25 */ << VAbstractTool::AttrKCurve /* 25 */
<< VAbstractTool::AttrLineColor /* 26 */
<< VAbstractTool::AttrColor; /* 27 */
return attr; return attr;
} }

View File

@ -73,6 +73,10 @@ private:
template<class Tool> template<class Tool>
void AddPropertyLineType(Tool *i, const QString &propertyName, const QMap<QString, QIcon> &styles); void AddPropertyLineType(Tool *i, const QString &propertyName, const QMap<QString, QIcon> &styles);
template<class Tool>
void AddPropertyLineColor(Tool *i, const QString &propertyName, const QMap<QString, QString> &colors,
const QString &id);
void AddPropertyFormula(const QString &propertyName, const VFormula &formula, const QString &attrName); void AddPropertyFormula(const QString &propertyName, const VFormula &formula, const QString &attrName);
QStringList PropertiesList() const; QStringList PropertiesList() const;

View File

@ -35,5 +35,6 @@
#include "plugins/vshortcutproperty.h" #include "plugins/vshortcutproperty.h"
#include "plugins/vstringproperty.h" #include "plugins/vstringproperty.h"
#include "plugins/vwidgetproperty.h" #include "plugins/vwidgetproperty.h"
#include "plugins/vlinecolorproperty.h"
#endif // VPROPERTIES_H #endif // VPROPERTIES_H