Seamly2D
Code documentation
vtooloptionspropertybrowser.h
Go to the documentation of this file.
1 /******************************************************************************
2 * @file vtooloptionspropertybrowser.h
3 ** @author Douglas S Caskey
4 ** @date 30 Apr, 2023
5 **
6 ** @brief
7 ** @copyright
8 ** This source code is part of the Seamly2D project, a pattern making
9 ** program to create and model patterns of clothing.
10 ** Copyright (C) 2017-2023 Seamly2D project
11 ** <https://github.com/fashionfreedom/seamly2d> All Rights Reserved.
12 **
13 ** Seamly2D is free software: you can redistribute it and/or modify
14 ** it under the terms of the GNU General Public License as published by
15 ** the Free Software Foundation, either version 3 of the License, or
16 ** (at your option) any later version.
17 **
18 ** Seamly2D is distributed in the hope that it will be useful,
19 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ** GNU General Public License for more details.
22 **
23 ** You should have received a copy of the GNU General Public License
24 ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
25 **
26 *************************************************************************/
27 
28 /************************************************************************
29  **
30  ** @file vtooloptionspropertybrowser.h
31  ** @author Roman Telezhynskyi <dismine(at)gmail.com>
32  ** @date 22 8, 2014
33  **
34  ** @brief
35  ** @copyright
36  ** This source code is part of the Valentine project, a pattern making
37  ** program, whose allow create and modeling patterns of clothing.
38  ** Copyright (C) 2013-2015 Seamly2D project
39  ** <https://github.com/fashionfreedom/seamly2d> All Rights Reserved.
40  **
41  ** Seamly2D is free software: you can redistribute it and/or modify
42  ** it under the terms of the GNU General Public License as published by
43  ** the Free Software Foundation, either version 3 of the License, or
44  ** (at your option) any later version.
45  **
46  ** Seamly2D is distributed in the hope that it will be useful,
47  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
48  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
49  ** GNU General Public License for more details.
50  **
51  ** You should have received a copy of the GNU General Public License
52  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
53  **
54  *************************************************************************/
55 
56 #ifndef VTOOLOPTIONSPROPERTYBROWSER_H
57 #define VTOOLOPTIONSPROPERTYBROWSER_H
58 
59 #include <QObject>
60 #include <QMap>
61 
62 #include "../vgeometry/vgeometrydef.h"
63 #include "../vpropertyexplorer/vproperty.h"
64 #include "../vpropertyexplorer/vpropertymodel.h"
65 #include "../vpropertyexplorer/vpropertyformview.h"
66 
67 class QDockWidget;
68 class QGraphicsItem;
69 class QScrollArea;
70 class VFormula;
71 class VContainer;
72 
73 class VToolOptionsPropertyBrowser : public QObject
74 {
75  Q_OBJECT
76 public:
77  explicit VToolOptionsPropertyBrowser(const VContainer *data, QDockWidget *parent);
78  void clearPropertyBrowser();
79 
80 public slots:
81  void itemClicked(QGraphicsItem *item);
82  void updateOptions();
83  void refreshOptions();
84 
85 private slots:
86  void userChangedData(VPE::VProperty *property);
87 
88 protected:
89  Q_DISABLE_COPY(VToolOptionsPropertyBrowser)
90 
92  VPE::VPropertyModel *propertyModel;
93  VPE::VPropertyFormView *formView;
94 
95  QGraphicsItem *currentItem;
96  QMap<VPE::VProperty *, QString> propertyToId;
97  QMap<QString, VPE::VProperty *> idToProperty;
98 
99 private:
100  void addProperty(VPE::VProperty *property, const QString &id);
101  void showItemOptions(QGraphicsItem *item);
102 
103  template<class Tool>
104  QMap<QString, quint32> getObjectList(Tool *tool, GOType objType);
105 
106  template<class Tool>
107  void setPointName(const QString &name);
108 
109  template<class Tool>
110  void setPointName1(const QString &name);
111 
112  template<class Tool>
113  void setPointName2(const QString &name);
114 
115  template<class Tool>
116  void setOperationSuffix(const QString &suffix);
117 
118  template<class Type>
119  Type getCrossPoint(const QVariant &value);
120 
121  template<class Tool>
122  void setCirclesCrossPoint(const QVariant &value);
123 
124  template<class Tool>
125  void setCurveVCrossPoint(const QVariant &value);
126 
127  template<class Tool>
128  void setCurveHCrossPoint(const QVariant &value);
129 
130  template<class Tool>
131  void setAxisType(const QVariant &value);
132 
133  template<class Tool>
134  void addPropertyObjectName(Tool *tool, const QString &propertyName, bool readOnly = false);
135 
136  template<class Tool>
137  void addPropertyPointName1(Tool *tool, const QString &propertyName);
138 
139  template<class Tool>
140  void addPropertyPointName2(Tool *tool, const QString &propertyName);
141 
142  template<class Tool>
143  void addPropertyOperationSuffix(Tool *tool, const QString &propertyName, bool readOnly = false);
144 
145  template<class Tool>
146  void addPropertyLineName(Tool *tool, const QString &propertyName, bool readOnly = false);
147 
148  template<class Tool>
149  void addPropertyCurveName(Tool *tool, const QString &propertyName, const QString &prefix,
150  const QString &firstPoint, const QString &secondPoint, bool readOnly = false);
151 
152  template<class Tool>
153  void addPropertyCrossPoint(Tool *tool, const QString &propertyName);
154 
155  template<class Tool>
156  void addPropertyVCrossPoint(Tool *tool, const QString &propertyName);
157 
158  template<class Tool>
159  void addPropertyHCrossPoint(Tool *tool, const QString &propertyName);
160 
161  template<class Tool>
162  void addPropertyAxisType(Tool *tool, const QString &propertyName);
163 
164  template<class Tool>
165  void addPropertyLineType(Tool *tool, const QString &propertyName);
166 
167  template<class Tool>
168  void addPropertyCurveLineType(Tool *tool, const QString &propertyName);
169 
170  template<class Tool>
171  void addPropertyLineWeight(Tool *tool, const QString &propertyName);
172 
173  template<class Tool>
174  void addPropertyLineColor(Tool *tool, const QString &propertyName, const QString &id);
175 
176  template<class Tool>
177  void addObjectProperty(Tool *tool, const QString &pointName, const QString &propertyName,
178  const QString &id, GOType objType);
179 
180  void addPropertyFormula(const QString &propertyName, const VFormula &formula, const QString &attrName);
181  void addPropertyParentPointName(const QString &pointName, const QString &propertyName,
182  const QString &propertyAttribute);
183 
184  void addPropertyLabel(const QString &propertyName, const QString &propertyAttribute);
185 
186  QStringList propertiesList() const;
187 
188  void changeDataToolSinglePoint(VPE::VProperty *property);
189  void changeDataToolEndLine(VPE::VProperty *property);
190  void changeDataToolAlongLine(VPE::VProperty *property);
191  void changeDataToolArc(VPE::VProperty *property);
192  void changeDataToolArcWithLength(VPE::VProperty *property);
193  void changeDataToolBisector(VPE::VProperty *property);
194  void changeDataToolTrueDarts(VPE::VProperty *property);
195  void changeDataToolCutArc(VPE::VProperty *property);
196  void changeDataToolCutSpline(VPE::VProperty *property);
197  void changeDataToolCutSplinePath(VPE::VProperty *property);
198  void changeDataToolHeight(VPE::VProperty *property);
199  void changeDataToolLine(VPE::VProperty *property);
200  void changeDataToolLineIntersect(VPE::VProperty *property);
201  void changeDataToolNormal(VPE::VProperty *property);
202  void changeDataToolPointOfContact(VPE::VProperty *property);
203  void changeDataToolPointOfIntersection(VPE::VProperty *property);
204  void changeDataToolPointOfIntersectionArcs(VPE::VProperty *property);
205  void changeDataToolPointOfIntersectionCircles(VPE::VProperty *property);
206  void changeDataToolPointOfIntersectionCurves(VPE::VProperty *property);
207  void changeDataToolPointFromCircleAndTangent(VPE::VProperty *property);
208  void changeDataToolPointFromArcAndTangent(VPE::VProperty *property);
209  void changeDataToolShoulderPoint(VPE::VProperty *property);
210  void changeDataToolSpline(VPE::VProperty *property);
211  void changeDataToolCubicBezier(VPE::VProperty *property);
212  void changeDataToolSplinePath(VPE::VProperty *property);
213  void changeDataToolCubicBezierPath(VPE::VProperty *property);
214  void changeDataToolTriangle(VPE::VProperty *property);
215  void changeDataToolLineIntersectAxis(VPE::VProperty *property);
216  void changeDataToolCurveIntersectAxis(VPE::VProperty *property);
217  void changeDataToolRotation(VPE::VProperty *property);
218  void changeDataToolMove(VPE::VProperty *property);
219  void changeDataToolMirrorByLine(VPE::VProperty *property);
220  void changeDataToolMirrorByAxis(VPE::VProperty *property);
221  void changeDataToolEllipticalArc(VPE::VProperty *property);
222 
223  void showOptionsToolSinglePoint(QGraphicsItem *item);
224  void showOptionsToolEndLine(QGraphicsItem *item);
225  void showOptionsToolAlongLine(QGraphicsItem *item);
226  void showOptionsToolArc(QGraphicsItem *item);
227  void showOptionsToolArcWithLength(QGraphicsItem *item);
228  void showOptionsToolBisector(QGraphicsItem *item);
229  void showOptionsToolTrueDarts(QGraphicsItem *item);
230  void showOptionsToolCutArc(QGraphicsItem *item);
231  void showOptionsToolCutSpline(QGraphicsItem *item);
232  void showOptionsToolCutSplinePath(QGraphicsItem *item);
233  void showOptionsToolHeight(QGraphicsItem *item);
234  void showOptionsToolLine(QGraphicsItem *item);
235  void showOptionsToolLineIntersect(QGraphicsItem *item);
236  void showOptionsToolNormal(QGraphicsItem *item);
237  void showOptionsToolPointOfContact(QGraphicsItem *item);
238  void showOptionsToolPointOfIntersection(QGraphicsItem *item);
239  void showOptionsToolPointOfIntersectionArcs(QGraphicsItem *item);
240  void showOptionsToolPointOfIntersectionCircles(QGraphicsItem *item);
241  void showOptionsToolPointOfIntersectionCurves(QGraphicsItem *item);
242  void showOptionsToolPointFromCircleAndTangent(QGraphicsItem *item);
243  void showOptionsToolPointFromArcAndTangent(QGraphicsItem *item);
244  void showOptionsToolShoulderPoint(QGraphicsItem *item);
245  void showOptionsToolSpline(QGraphicsItem *item);
246  void showOptionsToolCubicBezier(QGraphicsItem *item);
247  void showOptionsToolSplinePath(QGraphicsItem *item);
248  void showOptionsToolCubicBezierPath(QGraphicsItem *item);
249  void showOptionsToolTriangle(QGraphicsItem *item);
250  void showOptionsToolLineIntersectAxis(QGraphicsItem *item);
251  void showOptionsToolCurveIntersectAxis(QGraphicsItem *item);
252  void showOptionsToolRotation(QGraphicsItem *item);
253  void showOptionsToolMove(QGraphicsItem *item);
254  void showOptionsToolMirrorByLine(QGraphicsItem *item);
255  void showOptionsToolMirrorByAxis(QGraphicsItem *item);
256  void showOptionsToolEllipticalArc(QGraphicsItem *item);
257 
261  void updateOptionsToolArc();
269  void updateOptionsToolLine();
288  void updateOptionsToolMove();
292 };
293 
294 #endif // VTOOLOPTIONSPROPERTYBROWSER_H
The VContainer class container of all variables.
Definition: vcontainer.h:141
void showOptionsToolSinglePoint(QGraphicsItem *item)
void showOptionsToolLineIntersect(QGraphicsItem *item)
void changeDataToolEndLine(VPE::VProperty *property)
void addObjectProperty(Tool *tool, const QString &pointName, const QString &propertyName, const QString &id, GOType objType)
void showOptionsToolEndLine(QGraphicsItem *item)
void userChangedData(VPE::VProperty *property)
void changeDataToolTrueDarts(VPE::VProperty *property)
void showOptionsToolSpline(QGraphicsItem *item)
void addPropertyOperationSuffix(Tool *tool, const QString &propertyName, bool readOnly=false)
void showItemOptions(QGraphicsItem *item)
void setCurveVCrossPoint(const QVariant &value)
void changeDataToolAlongLine(VPE::VProperty *property)
void showOptionsToolCutSplinePath(QGraphicsItem *item)
void showOptionsToolLineIntersectAxis(QGraphicsItem *item)
void showOptionsToolMirrorByAxis(QGraphicsItem *item)
void addPropertyLineType(Tool *tool, const QString &propertyName)
VToolOptionsPropertyBrowser(const VContainer *data, QDockWidget *parent)
void setCurveHCrossPoint(const QVariant &value)
void showOptionsToolEllipticalArc(QGraphicsItem *item)
void addPropertyCurveName(Tool *tool, const QString &propertyName, const QString &prefix, const QString &firstPoint, const QString &secondPoint, bool readOnly=false)
void showOptionsToolRotation(QGraphicsItem *item)
void setCirclesCrossPoint(const QVariant &value)
void changeDataToolNormal(VPE::VProperty *property)
void addPropertyCrossPoint(Tool *tool, const QString &propertyName)
void changeDataToolCubicBezierPath(VPE::VProperty *property)
void addPropertyLineName(Tool *tool, const QString &propertyName, bool readOnly=false)
void addProperty(VPE::VProperty *property, const QString &id)
void changeDataToolPointOfIntersectionCurves(VPE::VProperty *property)
void addPropertyObjectName(Tool *tool, const QString &propertyName, bool readOnly=false)
void showOptionsToolCutArc(QGraphicsItem *item)
void changeDataToolPointFromCircleAndTangent(VPE::VProperty *property)
void showOptionsToolPointOfIntersectionCircles(QGraphicsItem *item)
void showOptionsToolCurveIntersectAxis(QGraphicsItem *item)
void changeDataToolMove(VPE::VProperty *property)
void changeDataToolHeight(VPE::VProperty *property)
void addPropertyPointName1(Tool *tool, const QString &propertyName)
void showOptionsToolSplinePath(QGraphicsItem *item)
Type getCrossPoint(const QVariant &value)
void addPropertyAxisType(Tool *tool, const QString &propertyName)
void changeDataToolCubicBezier(VPE::VProperty *property)
QMap< QString, VPE::VProperty * > idToProperty
void changeDataToolEllipticalArc(VPE::VProperty *property)
void showOptionsToolArc(QGraphicsItem *item)
void showOptionsToolPointOfIntersection(QGraphicsItem *item)
void addPropertyLineColor(Tool *tool, const QString &propertyName, const QString &id)
void changeDataToolBisector(VPE::VProperty *property)
void changeDataToolPointOfContact(VPE::VProperty *property)
void showOptionsToolPointFromCircleAndTangent(QGraphicsItem *item)
void addPropertyParentPointName(const QString &pointName, const QString &propertyName, const QString &propertyAttribute)
void showOptionsToolAlongLine(QGraphicsItem *item)
void changeDataToolPointOfIntersectionCircles(VPE::VProperty *property)
void changeDataToolLineIntersectAxis(VPE::VProperty *property)
void addPropertyCurveLineType(Tool *tool, const QString &propertyName)
void addPropertyHCrossPoint(Tool *tool, const QString &propertyName)
void setOperationSuffix(const QString &suffix)
QMap< QString, quint32 > getObjectList(Tool *tool, GOType objType)
void showOptionsToolCubicBezierPath(QGraphicsItem *item)
void setAxisType(const QVariant &value)
void showOptionsToolTrueDarts(QGraphicsItem *item)
void changeDataToolMirrorByAxis(VPE::VProperty *property)
void showOptionsToolShoulderPoint(QGraphicsItem *item)
void addPropertyLabel(const QString &propertyName, const QString &propertyAttribute)
void changeDataToolArcWithLength(VPE::VProperty *property)
void changeDataToolTriangle(VPE::VProperty *property)
void changeDataToolCutArc(VPE::VProperty *property)
void changeDataToolSpline(VPE::VProperty *property)
void showOptionsToolPointOfIntersectionArcs(QGraphicsItem *item)
void showOptionsToolCubicBezier(QGraphicsItem *item)
void showOptionsToolNormal(QGraphicsItem *item)
void changeDataToolPointOfIntersectionArcs(VPE::VProperty *property)
void addPropertyVCrossPoint(Tool *tool, const QString &propertyName)
void changeDataToolPointOfIntersection(VPE::VProperty *property)
void changeDataToolLineIntersect(VPE::VProperty *property)
void addPropertyFormula(const QString &propertyName, const VFormula &formula, const QString &attrName)
void changeDataToolCutSplinePath(VPE::VProperty *property)
void showOptionsToolLine(QGraphicsItem *item)
void changeDataToolArc(VPE::VProperty *property)
void changeDataToolMirrorByLine(VPE::VProperty *property)
void showOptionsToolPointOfIntersectionCurves(QGraphicsItem *item)
void showOptionsToolPointOfContact(QGraphicsItem *item)
void showOptionsToolArcWithLength(QGraphicsItem *item)
void addPropertyLineWeight(Tool *tool, const QString &propertyName)
QMap< VPE::VProperty *, QString > propertyToId
void changeDataToolLine(VPE::VProperty *property)
void showOptionsToolHeight(QGraphicsItem *item)
void showOptionsToolCutSpline(QGraphicsItem *item)
void changeDataToolSplinePath(VPE::VProperty *property)
void showOptionsToolBisector(QGraphicsItem *item)
void changeDataToolCutSpline(VPE::VProperty *property)
void showOptionsToolMove(QGraphicsItem *item)
void changeDataToolCurveIntersectAxis(VPE::VProperty *property)
void addPropertyPointName2(Tool *tool, const QString &propertyName)
void showOptionsToolTriangle(QGraphicsItem *item)
void showOptionsToolMirrorByLine(QGraphicsItem *item)
void changeDataToolPointFromArcAndTangent(VPE::VProperty *property)
void showOptionsToolPointFromArcAndTangent(QGraphicsItem *item)
void changeDataToolShoulderPoint(VPE::VProperty *property)
void changeDataToolSinglePoint(VPE::VProperty *property)
void changeDataToolRotation(VPE::VProperty *property)
Tool
Definition: def.h:161
GOType
Definition: vgeometrydef.h:56