Seamly2D
Code documentation
pen_toolbar.h
Go to the documentation of this file.
1 /******************************************************************************
2  * @file pen_toolbar.h
3  ** @author DS Caskey
4  ** @date Jan 16, 2023
5  **
6  ** @brief
7  ** @copyright
8  ** This source code is part of the Seamly2D project, a pattern making
9  ** program, whose allow create and modeling 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 #ifndef PEN_TOOLBAR_H
29 #define PEN_TOOLBAR_H
30 
31 #include <memory>
32 #include <QToolBar>
33 #include <QToolButton>
34 #include <QAction>
35 #include <QObject>
36 #include <QPointer>
37 
38 #include "color_combobox.h"
39 #include "lineweight_combobox.h"
40 #include "linetype_combobox.h"
41 
42 class QAction;
43 class QToolButton;
44 
45 class ColorComboBox;
46 class LineWeightComboBox;
47 class LineTypeComboBox;
48 
49 struct Pen
50 {
51  QString color{QString("black")};
52  qreal lineWeight{1.20};
53  QString lineType{QString("solidline")};
54 };
55 
56 class PenToolBar: public QToolBar
57 {
58 
59  Q_OBJECT
60 
61 public:
62  PenToolBar(const QString &title, QWidget *parent = 0);
63  virtual ~PenToolBar();
64 
65  Pen getPen() const;
67  QPointer<ColorComboBox> colorBox;
68  QPointer<LineTypeComboBox> lineTypeBox;
69  QPointer<LineWeightComboBox> lineWeightBox;
70 
71 public slots:
72  void colorChanged(const QString &color);
73  void lineWeightChanged(const qreal &weight);
74  void lineTypeChanged(const QString &type);
75  void penReset();
76  void savePreset();
77 
78 signals:
79  void penChanged(Pen pen);
80 
81 private:
82  QAction *resetAction;
83  QAction *savePresetAction;
84 };
85 
86 #endif
void penReset()
penReset resets the current pen to the preferred defaults.
Pen getPen() const
Definition: pen_toolbar.cpp:97
QPointer< LineWeightComboBox > lineWeightBox
Definition: pen_toolbar.h:69
void savePreset()
QPointer< LineTypeComboBox > lineTypeBox
Definition: pen_toolbar.h:68
void penChanged(Pen pen)
Pen currentPen
Definition: pen_toolbar.h:66
PenToolBar(const QString &title, QWidget *parent=0)
Definition: pen_toolbar.cpp:39
QPointer< ColorComboBox > colorBox
Definition: pen_toolbar.h:67
QAction * savePresetAction
Definition: pen_toolbar.h:83
virtual ~PenToolBar()
QAction * resetAction
Definition: pen_toolbar.h:82
void colorChanged(const QString &color)
void lineTypeChanged(const QString &type)
void lineWeightChanged(const qreal &weight)
Definition: pen.h:37
QString color
Definition: pen_toolbar.h:51
qreal lineWeight
Definition: pen_toolbar.h:52
QString lineType
Definition: pen_toolbar.h:53