51 #include <QMessageLogger>
54 #include <QSharedPointer>
59 #include "../../dialogs/tools/dialogline.h"
60 #include "../../dialogs/tools/dialogtool.h"
61 #include "../../visualization/visualization.h"
62 #include "../../visualization/line/vistoolline.h"
63 #include "../ifc/exception/vexception.h"
64 #include "../ifc/ifcdef.h"
65 #include "../vgeometry/vgobject.h"
66 #include "../vgeometry/vpointf.h"
67 #include "../vmisc/vabstractapplication.h"
68 #include "../vpatterndb/vcontainer.h"
69 #include "../vwidgets/vmaingraphicsscene.h"
70 #include "../vabstracttool.h"
88 const QString &lineType,
const QString &lineWeight,
const QString &lineColor,
89 const Source &typeCreation, QGraphicsItem *parent)
91 , QGraphicsLineItem(parent)
92 , firstPoint(firstPoint)
93 , secondPoint(secondPoint)
94 , lineColor(lineColor)
101 this->setFlag(QGraphicsItem::ItemStacksBehindParent,
true);
102 this->setFlag(QGraphicsItem::ItemIsFocusable,
true);
103 this->setAcceptHoverEvents(
true);
119 dialogTool->setLineName();
139 const quint32
firstPoint = dialogTool->getFirstPoint();
140 const quint32
secondPoint = dialogTool->getSecondPoint();
141 const QString lineType = dialogTool->getLineType();
142 const QString lineWeight = dialogTool->getLineWeight();
143 const QString
lineColor = dialogTool->getLineColor();
145 VToolLine *line =
Create(0,
firstPoint,
secondPoint, lineType, lineWeight,
lineColor, scene,
doc,
data,
Document::FullParse,
170 const QString &lineType,
const QString &lineWeight,
const QString &lineColor,
197 scene->addItem(line);
220 void VToolLine::paint(QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget)
230 QGraphicsLineItem::paint(painter, option, widget);
271 this->setEnabled(enabled);
277 setAcceptHoverEvents(enabled);
283 setFlag(QGraphicsItem::ItemIsSelectable, enabled);
296 ContextMenu<DialogLine>(event);
336 QGraphicsLineItem::hoverEnterEvent(event);
349 QGraphicsLineItem::hoverLeaveEvent(event);
375 if (change == QGraphicsItem::ItemSelectedChange)
380 return QGraphicsItem::itemChange(change, value);
390 switch (event->key())
406 QGraphicsItem::keyReleaseEvent ( event );
450 if (not
vis.isNull())
469 const QLineF line(
static_cast<QPointF
>(*first),
static_cast<QPointF
>(*second));
471 const QString toolTip = QString(
"<table>"
472 "<tr> <td><b>%1:</b> %2 %3</td> </tr>"
473 "<tr> <td><b>%4:</b> %5°</td> </tr>"
476 .arg(
qApp->fromPixel(line.length()))
508 AddVisualization<VisToolLine>();
592 this->setLine(QLineF(
static_cast<QPointF
>(*first),
static_cast<QPointF
>(*second)));
The DialogLine class dialog for ToolLine. Help create line and edit option.
virtual void UpdateToolData(const quint32 &id, VContainer *data)=0
QString useGroupColor(quint32 toolId, QString color)
virtual void IncrementReferens(quint32 id) const =0
static void AddTool(quint32 id, VDataTool *tool)
AddTool add tool to list tools.
static const QString TagLine
QString useGroupLineWeight(quint32 toolId, QString weight)
QString useGroupLineType(quint32 toolId, QString type)
virtual void DecrementReferens(quint32 id) const =0
The VContainer class container of all variables.
static quint32 getNextId()
getNextId generate next unique id
void AddLine(const quint32 &firstPointId, const quint32 &secondPointId)
AddLine add line to container.
static void UpdateId(quint32 newId)
UpdateId update id. If new id bigger when current save new like current.
const QSharedPointer< VGObject > GetGObject(quint32 id) const
GetGObject returns a point by id.
const QSharedPointer< T > GeometricObject(const quint32 &id) const
static QString GetParametrString(const QDomElement &domElement, const QString &name, const QString &defValue=QString())
Returns the string value of the given attribute. RENAME: see above.
static quint32 GetParametrUInt(const QDomElement &domElement, const QString &name, const QString &defValue)
Returns the long long value of the given attribute. RENAME: GetParameterLongLong?
void SetAttribute(QDomElement &domElement, const QString &name, const T &value) const
SetAttribute set attribute in pattern file. Replace "," by ".".
The VMainGraphicsScene class main scene.
void EnableLineItemHover(bool enabled)
void EnableLineItemSelection(bool enable)
The VPointF class keep data of point.
void setLineWeight(const QString &value)
void setObject1Id(const quint32 &value)
void setLineStyle(const Qt::PenStyle &value)
double ToPixel(double val, const Unit &unit)
QString UnitsToStr(const Unit &unit, const bool translate)
UnitsToStr translate unit to string.
qreal sceneScale(QGraphicsScene *scene)
qreal scaleWidth(qreal width, qreal scale)
QColor correctColor(const QGraphicsItem *item, const QColor &color)
const QString AttrLineType
const QString AttrSecondPoint
const QString LineTypeSolidLine
const QString AttrFirstPoint
const QString AttrLineWeight
const QString AttrLineColor
Qt::PenStyle lineTypeToPenStyle(const QString &lineType)
LineStyle return pen style for current line style.