Seamly2D
Code documentation
groups_widget.h
Go to the documentation of this file.
1 /***************************************************************************
2  ** @file groups_widget.h
3  ** @author Douglas S Caskey
4  ** @date 11 Jun, 2023
5  **
6  ** @copyright
7  ** Copyright (C) 2017 - 2023 Seamly, LLC
8  ** https://github.com/fashionfreedom/seamly2d
9  **
10  ** @brief
11  ** Seamly2D is free software: you can redistribute it and/or modify
12  ** it under the terms of the GNU General Public License as published by
13  ** the Free Software Foundation, either version 3 of the License, or
14  ** (at your option) any later version.
15  **
16  ** Seamly2D is distributed in the hope that it will be useful,
17  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
18  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  ** GNU General Public License for more details.
20  **
21  ** You should have received a copy of the GNU General Public License
22  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
23  **************************************************************************/
24 
25  /************************************************************************
26  **
27  ** @file vwidgetgroups.h
28  ** @author Roman Telezhynskyi <dismine(at)gmail.com>
29  ** @date 6 4, 2016
30  **
31  ** @brief
32  ** @copyright
33  ** This source code is part of the Valentina project, a pattern making
34  ** program, whose allow create and modeling patterns of clothing.
35  ** Copyright (C) 2016 Valentina project
36  ** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
37  **
38  ** Valentina is free software: you can redistribute it and/or modify
39  ** it under the terms of the GNU General Public License as published by
40  ** the Free Software Foundation, either version 3 of the License, or
41  ** (at your option) any later version.
42  **
43  ** Valentina is distributed in the hope that it will be useful,
44  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
45  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
46  ** GNU General Public License for more details.
47  **
48  ** You should have received a copy of the GNU General Public License
49  ** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
50  **
51  *************************************************************************/
52 
53 #ifndef GROUPS_WIDGET_H
54 #define GROUPS_WIDGET_H
55 
56 #include "../ifc/xml/vabstractpattern.h"
57 #include "../vtools/dialogs/tools/editgroup_dialog.h"
58 
59 #include <QColor>
60 #include <QTableWidget>
61 #include <QWidget>
62 
63 class VAbstractPattern;
64 class VContainer;
65 class EditGroupDialog;
66 
67 namespace Ui
68 {
69  class GroupsWidget;
70 }
71 
72 class GroupsWidget : public QWidget
73 {
74  Q_OBJECT
75 
76 public:
77  explicit GroupsWidget(VContainer *data, VAbstractPattern *doc, QWidget *parent = nullptr);
78  virtual ~GroupsWidget();
79 
80 public slots:
81  void updateGroups();
82  void showGroups(QMap<quint32,QString> groups);
83  void showAllGroups();
84  void hideAllGroups();
85  void lockAllGroups();
86  void unlockAllGroups();
87  void addGroupToList();
88  void deleteGroupFromList();
89  void editGroup();
90  quint32 getGroupId();
91  QString getCurrentGroupName();
92  void setAddGroupEnabled(bool value);
93  void clear();
94 
95 private slots:
96  void groupVisibilityChanged(int row, int column);
97  void groupLockChanged(int row, int column);
98  void renameGroup(int row, int column);
99  void groupContextMenu(const QPoint &pos);
100  void draftBlockHasGroups(bool value);
101 
102 private:
103  Q_DISABLE_COPY(GroupsWidget)
109 
110  void fillTable(const QMap<quint32, GroupAttributes> &groups);
111  void fillGroupItemList();
112  void addGroupItem(const quint32 &toolId, const quint32 &objId, const Tool &tooltype);
113  void groupItemContextMenu(const QPoint &pos);
114  void itemDoubleClicked(QListWidgetItem *item);
115  void zoomToObject(QSharedPointer<VPointF> point);
116  void setGroupVisibility(QTableWidgetItem *item, const quint32 &groupId, const bool &visible);
117  QString getPointName(quint32 pointId);
118  quint32 attrUInt(const QDomElement &domElement, const QString &name);
119  QString getObjName(quint32 id);
120  void splitterMoved(int pos, int index);
121  void headerClicked(int index);
122 };
123 
124 #endif // GROUPS_WIDGET_H
void renameGroup(int row, int column)
virtual ~GroupsWidget()
quint32 attrUInt(const QDomElement &domElement, const QString &name)
attrUInt get unsigned integer attribute.
void showGroups(QMap< quint32, QString > groups)
QString getPointName(quint32 pointId)
getPointName get the name of the point by tool id.
void draftBlockHasGroups(bool value)
GroupsWidget(VContainer *data, VAbstractPattern *doc, QWidget *parent=nullptr)
VContainer * m_data
void groupItemContextMenu(const QPoint &pos)
ContextMenu show context menu for group objects.
void headerClicked(int index)
headerClicked Sort state whenever header section clicked.
void hideAllGroups()
quint32 getGroupId()
void fillTable(const QMap< quint32, GroupAttributes > &groups)
void groupVisibilityChanged(int row, int column)
void addGroupItem(const quint32 &toolId, const quint32 &objId, const Tool &tooltype)
addGroupItem Add group item with description in listwidget.
void showAllGroups()
void unlockAllGroups()
void setGroupVisibility(QTableWidgetItem *item, const quint32 &groupId, const bool &visible)
void zoomToObject(QSharedPointer< VPointF > point)
zoomToObject zoom to selected (point) object.
QString getObjName(quint32 id)
getObjName get the name of the graphics object.
bool m_patternHasGroups
void groupContextMenu(const QPoint &pos)
void fillGroupItemList()
void setAddGroupEnabled(bool value)
void splitterMoved(int pos, int index)
splitterMoved Save splitter state whenever it's moved.
void lockAllGroups()
void deleteGroupFromList()
Ui::GroupsWidget * ui
void addGroupToList()
VAbstractPattern * m_doc
quint32 m_currentGroupId
void itemDoubleClicked(QListWidgetItem *item)
Handle double clicking of list item.
void groupLockChanged(int row, int column)
QString getCurrentGroupName()
The VContainer class container of all variables.
Definition: vcontainer.h:141
The VPointF class keep data of point.
Definition: vpointf.h:75
Tool
Definition: def.h:161