Seamly2D
Code documentation
vtoolsinglepoint.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 vtoolsinglepoint.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 VTOOLSINGLEPOINT_H
53 #define VTOOLSINGLEPOINT_H
54 
55 #include <qcompilerdetection.h>
56 #include <QGraphicsItem>
57 #include <QMetaObject>
58 #include <QObject>
59 #include <QPointF>
60 #include <QString>
61 #include <QVariant>
62 #include <QtGlobal>
63 
64 #include "../vabstractpoint.h"
65 #include "../vmisc/def.h"
66 #include "../vwidgets/vscenepoint.h"
67 
68 template <class T> class QSharedPointer;
69 
70 /**
71  * @brief The VToolSinglePoint class parent for all tools what create points.
72  */
74 {
75  Q_OBJECT
76 public:
78  const QColor &lineColor, QGraphicsItem * parent = nullptr);
79  virtual ~VToolSinglePoint() Q_DECL_EQ_DEFAULT;
80 
81  virtual int type() const Q_DECL_OVERRIDE {return Type;}
82  enum { Type = UserType + static_cast<int>(Tool::SinglePoint)};
83 
84  QString name() const;
85  void setName(const QString &name);
86 
87  void SetEnabled(bool enabled);
88 
89  virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE;
90  virtual bool isPointNameVisible(quint32 id) const Q_DECL_OVERRIDE;
91  virtual void setPointNameVisiblity(quint32 id, bool visible) Q_DECL_OVERRIDE;
92  virtual void setPointNamePosition(quint32 id, const QPointF &pos) Q_DECL_OVERRIDE;
93 
94 public slots:
95  void pointnameChangedPosition(const QPointF &pos);
96  virtual void Disable(bool disable, const QString &draftBlockName) Q_DECL_OVERRIDE;
97  virtual void EnableToolMove(bool move) Q_DECL_OVERRIDE;
98  void pointChosen();
99  void pointSelected(bool selected);
100  virtual void FullUpdateFromFile() Q_DECL_OVERRIDE;
101  virtual void AllowHover(bool enabled) Q_DECL_OVERRIDE;
102  virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE;
103  void allowTextHover(bool enabled);
104  void allowTextSelectable(bool enabled);
105  virtual void ToolSelectionType(const SelectionType &type) Q_DECL_OVERRIDE;
106 
107 protected:
108  virtual void updatePointNameVisibility(quint32 id, bool visible) Q_DECL_OVERRIDE;
109  virtual void updatePointNamePosition(quint32 id, const QPointF &pos) Q_DECL_OVERRIDE;
110  virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
111  virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;
112  virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
113  virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value ) Q_DECL_OVERRIDE;
114  virtual void keyReleaseEvent(QKeyEvent * event) Q_DECL_OVERRIDE;
115  virtual void contextMenuEvent (QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
116  virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
117 
118 private:
119  Q_DISABLE_COPY(VToolSinglePoint)
120 };
121 
122 #endif // VTOOLSINGLEPOINT_H
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 VGObject class keep information graphical objects.
Definition: vgobject.h:74
The VToolSinglePoint class parent for all tools what create points.
virtual void Disable(bool disable, const QString &draftBlockName) Q_DECL_OVERRIDE
void pointnameChangedPosition(const QPointF &pos)
pointnameChangedPosition handle change position point text.
virtual void EnableToolMove(bool move) Q_DECL_OVERRIDE
virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE
mouseReleaseEvent handle mouse release events.
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE
FullUpdateFromFile update tool data form file.
void pointSelected(bool selected)
virtual void updatePointNamePosition(quint32 id, const QPointF &pos) Q_DECL_OVERRIDE
updatePointNamePosition save new position text to the pattern file.
QString name() const
virtual void setPointNamePosition(quint32 id, const QPointF &pos) Q_DECL_OVERRIDE
virtual void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE
keyReleaseEvent handle key release events.
virtual void AllowHover(bool enabled) Q_DECL_OVERRIDE
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) Q_DECL_OVERRIDE
virtual int type() const Q_DECL_OVERRIDE
virtual void SaveOptions(QDomElement &tag, QSharedPointer< VGObject > &obj) Q_DECL_OVERRIDE
void setName(const QString &name)
VToolSinglePoint(VAbstractPattern *doc, VContainer *data, quint32 id, const QColor &lineColor, QGraphicsItem *parent=nullptr)
VToolSinglePoint constructor.
virtual void ToolSelectionType(const SelectionType &type) Q_DECL_OVERRIDE
virtual bool isPointNameVisible(quint32 id) const Q_DECL_OVERRIDE
virtual ~VToolSinglePoint() Q_DECL_EQ_DEFAULT
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE
void allowTextHover(bool enabled)
void SetEnabled(bool enabled)
void allowTextSelectable(bool enabled)
virtual void updatePointNameVisibility(quint32 id, bool visible) Q_DECL_OVERRIDE
virtual void setPointNameVisiblity(quint32 id, bool visible) Q_DECL_OVERRIDE
virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE
itemChange hadle item change.
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE
@ SinglePoint
SelectionType
Definition: def.h:108