55 #include <QDomElement>
57 #include <QGraphicsLineItem>
58 #include <QGraphicsScene>
59 #include <QGraphicsSceneMouseEvent>
63 #include <QSharedPointer>
64 #include <QStaticStringData>
65 #include <QStringData>
66 #include <QStringDataPtr>
74 #include "../../../vgeometry/vpointf.h"
75 #include "../../../vwidgets/vgraphicssimpletextitem.h"
76 #include "../../undocommands/label/showpointname.h"
77 #include "../../undocommands/label/movelabel.h"
78 #include "../ifc/xml/vdomdocument.h"
79 #include "../ifc/ifcdef.h"
80 #include "../vmisc/vabstractapplication.h"
81 #include "../vpatterndb/vcontainer.h"
82 #include "../vpatterndb/vpiecenode.h"
83 #include "../vwidgets/vmaingraphicsscene.h"
84 #include "../vwidgets/vmaingraphicsview.h"
85 #include "../vabstracttool.h"
86 #include "../vdatatool.h"
87 #include "../pattern_piece_tool.h"
105 const QString &blockName,
const quint32 &idTool, QObject *qoParent, QGraphicsItem *parent)
106 :
VAbstractNode(doc, data, id, idPoint, blockName, idTool, qoParent)
113 this, [
this](QGraphicsSceneContextMenuEvent *event)
120 setCursor(Qt::ArrowCursor);
135 quint32
id, quint32 idPoint,
const Document &parse,
136 const Source &typeCreation,
const QString &blockName,
const quint32 &idTool)
156 point->setParent(tool);
161 scene->addItem(point);
228 VScenePoint::mousePressEvent(event);
231 if (not (flags() & ItemIsSelectable) && scene())
233 scene()->clearSelection();
243 QPoint point =
event->screenPos();
255 if (event->button() == Qt::LeftButton)
259 VScenePoint::mouseReleaseEvent(event);
272 point->setMx(pos.x());
273 point->setMy(pos.y());
279 if (QGraphicsScene *sc = scene())
292 point->setShowPointName(visible);
329 if (qgraphicsitem_cast<PatternPieceTool *>(parentItem()))
333 QAction *actionShowPointName = menu.addAction(QIcon(
"://icon/16x16/open_eye.png"), tr(
"Show Point Name"));
334 actionShowPointName->setCheckable(
true);
337 QAction *selectedAction = menu.exec(event->screenPos());
338 if (selectedAction == actionShowPointName)
348 m_pointName->setFlag(QGraphicsItem::ItemIsMovable, move);
354 setAcceptHoverEvents(enabled);
360 setFlag(QGraphicsItem::ItemIsSelectable, enabled);
372 m_pointName->setFlag(QGraphicsItem::ItemIsSelectable, enabled);
The VAbstractNode class parent class for all detail node.
static const QString AttrIdTool
quint32 idTool
idTool id tool.
quint32 idNode
idNodenode id.
virtual void ToolCreation(const Source &typeCreation) Q_DECL_OVERRIDE
void AddToModeling(const QDomElement &domElement)
AddToModeling add tag to modeling tag current pattern peace.
void SetParentType(const ParentType &value)
virtual void UpdateToolData(const quint32 &id, VContainer *data)=0
static void AddTool(quint32 id, VDataTool *tool)
AddTool add tool to list tools.
static VDataTool * getTool(quint32 id)
getTool return tool from tool list.
static const QString TagPoint
The VContainer class container of all variables.
const QSharedPointer< VGObject > GetGObject(quint32 id) const
GetGObject returns a point by id.
const QSharedPointer< T > GeometricObject(const quint32 &id) const
void SetAttribute(QDomElement &domElement, const QString &name, const T &value) const
SetAttribute set attribute in pattern file. Replace "," by ".".
static const QString AttrId
The VExceptionBadId class for exception bad id.
void setPosition(QPointF pos)
void showContextMenu(QGraphicsSceneContextMenuEvent *event)
showContextMenu emit when need show tool context menu.
void setShowParentTooltip(bool show)
void nameChangedPosition(const QPointF &pos)
nameChangedPosition emit when label change position.
The VMainGraphicsScene class main scene.
void EnablePointItemSelection(bool enable)
void enableTextItemSelection(bool enable)
void EnablePointItemHover(bool enable)
void enableTextItemHover(bool enable)
void EnableToolMove(bool move)
static void NewSceneRect(QGraphicsScene *sc, QGraphicsView *view, QGraphicsItem *item=nullptr)
NewSceneRect calculate scene rect what contains all items and doesn't less that size of scene view.
The VNodePoint class point detail node.
virtual void AddToFile() Q_DECL_OVERRIDE
AddToFile add tag with Information about tool into file.
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) Q_DECL_OVERRIDE
virtual void setPointNameVisiblity(quint32 id, bool visible) Q_DECL_OVERRIDE
virtual void ShowNode() Q_DECL_OVERRIDE
VNodePoint(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idPoint, const Source &typeCreation, const QString &blockName=QString(), const quint32 &idTool=0, QObject *qoParent=nullptr, QGraphicsItem *parent=nullptr)
VNodePoint constructor.
virtual void setPointNamePosition(quint32 id, const QPointF &pos) Q_DECL_OVERRIDE
setPointNamePosition change name text position.
static const QString ToolType
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override
void allowTextHover(bool enabled)
static void Create(VAbstractPattern *doc, VContainer *data, VMainGraphicsScene *scene, quint32 id, quint32 idPoint, const Document &parse, const Source &typeCreation, const QString &blockName=QString(), const quint32 &idTool=0)
Create help create tool.
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE
void allowTextSelectable(bool enabled)
virtual QString getTagName() const Q_DECL_OVERRIDE
virtual void HideNode() Q_DECL_OVERRIDE
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE
mouseReleaseEvent handle mouse release events.
virtual void AllowHover(bool enabled) Q_DECL_OVERRIDE
void nameChangedPosition(const QPointF &pos)
nameChangedPosition point name change position.
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE
showContextMenu emit when need show tool context menu.
void EnableToolMove(bool move)
virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE
The VPointF class keep data of point.
VGraphicsSimpleTextItem * m_pointName
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE
virtual void refreshPointGeometry(const VPointF &point)
const QString AttrShowPointName
const QString AttrIdObject