itom  4.1.0
penCreatorButton.h
1 /* ********************************************************************
2 itom measurement system
3 URL: http://www.uni-stuttgart.de/ito
4 Copyright (C) 2020, Institut fuer Technische Optik (ITO),
5 Universitaet Stuttgart, Germany
6 
7 This file is part of itom.
8 
9 itom 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 itom 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 itom. If not, see <http://www.gnu.org/licenses/>.
21 *********************************************************************** */
22 
23 
24 #ifndef PENCREATORBUTTON_H
25 #define PENCREATORBUTTON_H
26 
27 #include <QPushButton>
28 #include <qpen.h>
29 
30 #include "commonWidgets.h"
31 
33 
34 class ITOMWIDGETS_EXPORT PenCreatorButton : public QPushButton
35 {
36  Q_OBJECT
37 
38  Q_PROPERTY(QPen pen READ getPen WRITE setPen)
39  Q_PROPERTY(bool editableColor READ getColorState WRITE setColorState DESIGNABLE true)
40 
41 public:
42  explicit PenCreatorButton(QWidget* parent = 0);
43  explicit PenCreatorButton(QPen pen, QWidget* parent = 0 );
45 
46  QSize sizeHint() const;
47  QPen getPen() const;
48  bool getColorState() const;
49 
50 protected:
51  virtual void paintEvent(QPaintEvent* event);
52  void changePen();
53 
54  QScopedPointer<PenCreatorButtonPrivate> d_ptr;
55 protected slots:
56  void onToggled(bool change = true);
57 public slots:
60  void setPen(const QPen &pen);
61  void setColorState(const bool &val);
62 private:
63 
64  Q_DECLARE_PRIVATE(PenCreatorButton);
65  Q_DISABLE_COPY(PenCreatorButton);
66  signals:
67  void colorStateChanged(bool state);
68 
69 };
70 
71 
72 
73 
74 
75 
76 #endif
Definition: penCreatorButton.cpp:33
Definition: penCreatorButton.h:34