Seamly2D
Code documentation
vnodepoint.h
Go to the documentation of this file.
1 /***************************************************************************
2  * *
3  * Copyright (C) 2017 Seamly, LLC *
4  * *
5  * https://github.com/fashionfreedom/seamly2d *
6  * *
7  ***************************************************************************
8  **
9  ** Seamly2D is free software: you can redistribute it and/or modify
10  ** it under the terms of the GNU General Public License as published by
11  ** the Free Software Foundation, either version 3 of the License, or
12  ** (at your option) any later version.
13  **
14  ** Seamly2D is distributed in the hope that it will be useful,
15  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  ** GNU General Public License for more details.
18  **
19  ** You should have received a copy of the GNU General Public License
20  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
21  **
22  **************************************************************************
23 
24  ************************************************************************
25  **
26  ** @file vnodepoint.h
27  ** @author Roman Telezhynskyi <dismine(at)gmail.com>
28  ** @date November 15, 2013
29  **
30  ** @brief
31  ** @copyright
32  ** This source code is part of the Valentine project, a pattern making
33  ** program, whose allow create and modeling patterns of clothing.
34  ** Copyright (C) 2013-2015 Seamly2D project
35  ** <https://github.com/fashionfreedom/seamly2d> All Rights Reserved.
36  **
37  ** Seamly2D is free software: you can redistribute it and/or modify
38  ** it under the terms of the GNU General Public License as published by
39  ** the Free Software Foundation, either version 3 of the License, or
40  ** (at your option) any later version.
41  **
42  ** Seamly2D is distributed in the hope that it will be useful,
43  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
44  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45  ** GNU General Public License for more details.
46  **
47  ** You should have received a copy of the GNU General Public License
48  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
49  **
50  *************************************************************************/
51 
52 #ifndef VNODEPOINT_H
53 #define VNODEPOINT_H
54 
55 #include <qcompilerdetection.h>
56 #include <QGraphicsEllipseItem>
57 #include <QGraphicsItem>
58 #include <QMetaObject>
59 #include <QObject>
60 #include <QPointF>
61 #include <QString>
62 #include <QtGlobal>
63 
64 #include "../ifc/xml/vabstractpattern.h"
65 #include "../vmisc/def.h"
66 #include "vabstractnode.h"
67 #include "../vwidgets/vscenepoint.h"
68 
69 /**
70  * @brief The VNodePoint class point detail node.
71  */
72 class VNodePoint: public VAbstractNode, public VScenePoint
73 {
74  Q_OBJECT
75 public:
77  quint32 id, quint32 idPoint, const Document &parse, const Source &typeCreation,
78  const QString &blockName = QString(), const quint32 &idTool = 0);
79 
80  static const QString ToolType;
81  virtual int type() const Q_DECL_OVERRIDE {return Type;}
82  enum { Type = UserType + static_cast<int>(Tool::NodePoint)};
83  virtual QString getTagName() const Q_DECL_OVERRIDE;
84 
85  virtual void setPointNamePosition(quint32 id, const QPointF &pos) Q_DECL_OVERRIDE;
86  virtual void setPointNameVisiblity(quint32 id, bool visible) Q_DECL_OVERRIDE;
87 
88 signals:
89  /**
90  * @brief showContextMenu emit when need show tool context menu.
91  * @param event context menu event.
92  */
93  //void ShowOptions();
94  //void ToggleInLayout(bool checked);
95  //void Delete();
96 
97 public slots:
98  virtual void FullUpdateFromFile() Q_DECL_OVERRIDE;
99  void nameChangedPosition(const QPointF &pos);
100  void pointChosen();
101  void EnableToolMove(bool move);
102  virtual void AllowHover(bool enabled) Q_DECL_OVERRIDE;
103  virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE;
104  void allowTextHover(bool enabled);
105  void allowTextSelectable(bool enabled);
106 
107 protected:
108  virtual void AddToFile() Q_DECL_OVERRIDE;
109  virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
110  virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;
111  virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
112  virtual void ShowNode() Q_DECL_OVERRIDE;
113  virtual void HideNode() Q_DECL_OVERRIDE;
114  virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) Q_DECL_OVERRIDE;
115 
116 private:
117  Q_DISABLE_COPY(VNodePoint)
118 
119  VNodePoint(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 idPoint, const Source &typeCreation,
120  const QString &blockName = QString(), const quint32 &idTool = 0, QObject *qoParent = nullptr,
121  QGraphicsItem * parent = nullptr );
122 };
123 
124 #endif // VNODEPOINT_H
The VAbstractNode class parent class for all detail node.
Definition: vabstractnode.h:71
quint32 idTool
idTool id tool.
Definition: vabstractnode.h:97
VAbstractPattern * doc
doc dom document container
The VContainer class container of all variables.
Definition: vcontainer.h:141
VContainer data
data container with data
Definition: vdatatool.h:84
The VMainGraphicsScene class main scene.
The VNodePoint class point detail node.
Definition: vnodepoint.h:73
virtual void AddToFile() Q_DECL_OVERRIDE
AddToFile add tag with Information about tool into file.
Definition: vnodepoint.cpp:204
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) Q_DECL_OVERRIDE
Definition: vnodepoint.cpp:323
void pointChosen()
Definition: vnodepoint.cpp:179
virtual void setPointNameVisiblity(quint32 id, bool visible) Q_DECL_OVERRIDE
Definition: vnodepoint.cpp:287
virtual void ShowNode() Q_DECL_OVERRIDE
Definition: vnodepoint.cpp:308
virtual void setPointNamePosition(quint32 id, const QPointF &pos) Q_DECL_OVERRIDE
setPointNamePosition change name text position.
Definition: vnodepoint.cpp:267
static const QString ToolType
Definition: vnodepoint.h:80
virtual int type() const Q_DECL_OVERRIDE
Definition: vnodepoint.h:81
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override
Definition: vnodepoint.cpp:240
void allowTextHover(bool enabled)
Definition: vnodepoint.cpp:364
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.
Definition: vnodepoint.cpp:134
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE
Definition: vnodepoint.cpp:225
void allowTextSelectable(bool enabled)
Definition: vnodepoint.cpp:370
virtual QString getTagName() const Q_DECL_OVERRIDE
Definition: vnodepoint.cpp:173
virtual void HideNode() Q_DECL_OVERRIDE
Definition: vnodepoint.cpp:317
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE
mouseReleaseEvent handle mouse release events.
Definition: vnodepoint.cpp:253
virtual void AllowHover(bool enabled) Q_DECL_OVERRIDE
Definition: vnodepoint.cpp:352
void nameChangedPosition(const QPointF &pos)
nameChangedPosition point name change position.
Definition: vnodepoint.cpp:302
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE
showContextMenu emit when need show tool context menu.
Definition: vnodepoint.cpp:188
void EnableToolMove(bool move)
Definition: vnodepoint.cpp:346
virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE
Definition: vnodepoint.cpp:358
@ NodePoint
Source
Definition: def.h:106
Document