Seamly2D
Code documentation
doubleline_point_tool.h
Go to the documentation of this file.
1 /**************************************************************************
2  **
3  ** @file doubleline_point_tool.h
4  ** @author Douglas S Caskey
5  ** @date 7.19.2022
6  **
7  ** @brief
8  ** @copyright
9  ** This source code is part of the Valentine project, a pattern making
10  ** program, whose allow create and modeling patterns of clothing.
11  ** Copyright (C) 2013-2022 Seamly2D project
12  ** <https://github.com/fashionfreedom/seamly2d> All Rights Reserved.
13  **
14  ** Seamly2D is free software: you can redistribute it and/or modify
15  ** it under the terms of the GNU General Public License as published by
16  ** the Free Software Foundation, either version 3 of the License, or
17  ** (at your option) any later version.
18  **
19  ** Seamly2D is distributed in the hope that it will be useful,
20  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
21  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  ** GNU General Public License for more details.
23  **
24  ** You should have received a copy of the GNU General Public License
25  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
26  **
27  *************************************************************************/
28 
29 #ifndef DOUBLELINE_POINT_TOOL_H
30 #define DOUBLELINE_POINT_TOOL_H
31 
32 #include "../vmisc/def.h"
33 #include "../vpatterndb/vformula.h"
34 #include "../vtoolsinglepoint.h"
35 
36 #include <qcompilerdetection.h>
37 #include <QGraphicsItem>
38 #include <QMetaObject>
39 #include <QObject>
40 #include <QString>
41 #include <QtGlobal>
42 
43 template <class T> class QSharedPointer;
44 
45 /**
46  * @brief The DoubleLinePointTool class parent for all tools what creates a point with 2 lines.
47  */
49 {
50  Q_OBJECT
51 public:
53  const QString &typeLine, const QString &lineWeight,
54  const QString &lineColor,
55  const quint32 &firstPointId, const quint32 &secondPointId,
56  QGraphicsItem * parent = nullptr);
57  virtual ~DoubleLinePointTool() Q_DECL_OVERRIDE;
58 
59  virtual int type() const Q_DECL_OVERRIDE {return Type;}
60  enum {Type = UserType + static_cast<int>(Tool::LinePoint)};
61 
62  virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
63  QWidget *widget = nullptr) Q_DECL_OVERRIDE;
64 
65  QString point1Name() const;
66  QString point2Name() const;
67 
68  quint32 getFirstPointId() const;
69  void setFirstPointId(const quint32 &value);
70 
71  quint32 getSecondPointId() const;
72  void setSecondPointId(const quint32 &value);
73 
74  QString getLineColor() const;
75  void setLineColor(const QString &value);
76 
77 public slots:
78  virtual void Disable(bool disable, const QString &draftBlockName) Q_DECL_OVERRIDE;
79  virtual void FullUpdateFromFile() Q_DECL_OVERRIDE;
80 
81 protected:
82  quint32 firstPointId; /** @brief firstPointId id first line point. */
83  quint32 secondPointId; /** @brief secondPointId id second line point. */
84  VScaledLine *firstLine; /** @brief firstLine first line item. */
85  VScaledLine *secondLine; /** @brief secondLine second line item. */
86  QString lineColor; /** @brief lineColor color of a line. */
87 
88  virtual void RefreshGeometry();
89  virtual void RemoveReferens() Q_DECL_OVERRIDE;
90  virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
91  virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
92  virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
93  virtual QString makeToolTip() const Q_DECL_OVERRIDE;
94 
95 private:
96  Q_DISABLE_COPY(DoubleLinePointTool)
97 };
98 
99 #endif // DOUBLELINE_POINT_TOOL_H
The DoubleLinePointTool class parent for all tools what creates a point with 2 lines.
quint32 getSecondPointId() const
void setLineColor(const QString &value)
virtual int type() const Q_DECL_OVERRIDE
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr) Q_DECL_OVERRIDE
virtual void RefreshGeometry()
lineColor color of a line.
virtual QString makeToolTip() const Q_DECL_OVERRIDE
virtual void RemoveReferens() Q_DECL_OVERRIDE
RemoveReferens decrement value of reference.
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE
DoubleLinePointTool(VAbstractPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &lineWeight, const QString &lineColor, const quint32 &firstPointId, const quint32 &secondPointId, QGraphicsItem *parent=nullptr)
DoubleLinePointTool constructor.
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE
virtual void Disable(bool disable, const QString &draftBlockName) Q_DECL_OVERRIDE
VScaledLine * secondLine
firstLine first line item.
void setSecondPointId(const quint32 &value)
quint32 secondPointId
firstPointId id first line point.
void setFirstPointId(const quint32 &value)
QString lineColor
secondLine second line item.
virtual void SaveOptions(QDomElement &tag, QSharedPointer< VGObject > &obj) Q_DECL_OVERRIDE
VScaledLine * firstLine
secondPointId id second line point.
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE
FullUpdateFromFile update tool data from file.
virtual ~DoubleLinePointTool() Q_DECL_OVERRIDE
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.
@ LinePoint