Show line type for tool endLine.

--HG--
branch : feature
This commit is contained in:
dismine 2014-08-28 14:23:28 +03:00
parent a9667aac09
commit 37ec49065a
3 changed files with 19 additions and 8 deletions

View File

@ -289,7 +289,7 @@ Qt::PenStyle VAbstractTool::LineStyle(const QString &typeLine)
break; break;
} }
} }
QString VAbstractTool::getTypeLine() const QString VAbstractTool::getLineType() const
{ {
return typeLine; return typeLine;
} }

View File

@ -101,7 +101,7 @@ public:
static Qt::PenStyle LineStyle(const QString &typeLine); static Qt::PenStyle LineStyle(const QString &typeLine);
const VContainer *getData() const; const VContainer *getData() const;
QString getTypeLine() const; QString getLineType() const;
//void setTypeLine(const QString &value)=0; //void setTypeLine(const QString &value)=0;
QMap<QString, quint32> PointsList() const; QMap<QString, quint32> PointsList() const;
public slots: public slots:

View File

@ -128,15 +128,20 @@ void VToolOptionsPropertyBrowser::userChangedData(VProperty *property)
} }
case VToolEndLine::Type: case VToolEndLine::Type:
{ {
VToolEndLine *i = qgraphicsitem_cast<VToolEndLine *>(currentItem);
if (id == QLatin1String("name")) if (id == QLatin1String("name"))
{ {
SetPointName<VToolEndLine>(variant.toString()); SetPointName<VToolEndLine>(variant.toString());
} }
else if (id == QLatin1String("basePoint")) else if (id == QLatin1String("basePoint"))
{ {
VToolEndLine *i = qgraphicsitem_cast<VToolEndLine *>(currentItem);
i->setBasePointId(variant.toUInt()); i->setBasePointId(variant.toUInt());
} }
else if (id == QLatin1String("lineType"))
{
i->setTypeLine(variant.toString());
}
break; break;
} }
default: default:
@ -194,6 +199,10 @@ void VToolOptionsPropertyBrowser::UpdateOptions()
idToProperty[QLatin1String("name")]->setValue(i->name()); idToProperty[QLatin1String("name")]->setValue(i->name());
idToProperty[QLatin1String("basePoint")]->setValue(i->getBasePointId()); idToProperty[QLatin1String("basePoint")]->setValue(i->getBasePointId());
QStringList styles = VAbstractTool::Styles();
qint32 index = styles.indexOf(i->getLineType());
idToProperty[QLatin1String("lineType")]->setValue(index);
break; break;
} }
case VGraphicsSimpleTextItem::Type: case VGraphicsSimpleTextItem::Type:
@ -240,7 +249,7 @@ void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item)
{ {
VToolEndLine *i = qgraphicsitem_cast<VToolEndLine *>(item); VToolEndLine *i = qgraphicsitem_cast<VToolEndLine *>(item);
QDockWidget *parent = qobject_cast<QDockWidget *>(this->parent()); QDockWidget *parent = qobject_cast<QDockWidget *>(this->parent());
parent->setWindowTitle(tr("Tool options (End of line)")); parent->setWindowTitle(tr("Tool options (Point at distance and angle)"));
VProperty* itemName = new VProperty(tr("Point name")); VProperty* itemName = new VProperty(tr("Point name"));
itemName->setValue(i->name()); itemName->setValue(i->name());
@ -252,10 +261,12 @@ void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item)
pointsProperty->setValue(i->getBasePointId()); pointsProperty->setValue(i->getBasePointId());
AddProperty(pointsProperty, QLatin1String("basePoint")); AddProperty(pointsProperty, QLatin1String("basePoint"));
// VEnumProperty *enumProperty = new VEnumProperty(tr("list")); VEnumProperty *lineTypeProperty = new VEnumProperty(tr("Line type"));
// QStringList list = QStringList()<<"a1"<<"a2"<<"a3"; lineTypeProperty->setLiterals(VAbstractTool::Styles());
// enumProperty->setLiterals(list); QStringList styles = VAbstractTool::Styles();
// AddProperty(enumProperty, QLatin1String("list")); qint32 index = styles.indexOf(i->getLineType());
lineTypeProperty->setValue(index);
AddProperty(lineTypeProperty, QLatin1String("lineType"));
break; break;
} }
case VGraphicsSimpleTextItem::Type: case VGraphicsSimpleTextItem::Type: