itom  4.1.0
brushCreatorButton.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 BRUSHCREATORBUTTON_H
25 #define BRUSHCREATORBUTTON_H
26 
27 #include <QPushButton>
28 #include <qbrush.h>
29 
30 #include "commonWidgets.h"
31 
33 
34 class ITOMWIDGETS_EXPORT BrushCreatorButton : public QPushButton
35 {
36  Q_OBJECT
37 
38  Q_PROPERTY(QBrush brush READ getBrush WRITE setBrush)
39  Q_PROPERTY(bool showAlphaChannel READ getShowAlphaChannel WRITE setShowAlphaChannel)
40 
41 public:
42  explicit BrushCreatorButton(QWidget* parent = 0);
43  explicit BrushCreatorButton(QBrush brush, QWidget* parent = 0);
45 
46  QSize sizeHint() const;
47  QBrush getBrush() const;
48  bool getShowAlphaChannel() const;
49 
50 protected:
51  virtual void paintEvent(QPaintEvent* event);
52  void changeBrush();
53 
54  QScopedPointer<BrushCreatorButtonPrivate> d_ptr;
55 protected slots:
56  void onToggled(bool change = true);
57 public slots:
60  void setBrush(const QBrush &brush);
61 
62  void setShowAlphaChannel(bool showAlphaChannel);
63 private:
64 
65  Q_DECLARE_PRIVATE(BrushCreatorButton);
66  Q_DISABLE_COPY(BrushCreatorButton);
67 
68 };
69 
70 
71 
72 
73 
74 
75 #endif
Definition: brushCreatorButton.cpp:33
Definition: brushCreatorButton.h:34