MuseScore  3.4
Music composition and notation
colorlabel.h
Go to the documentation of this file.
1 //=============================================================================
2 // Awl
3 // Audio Widget Library
4 //
5 // Copyright (C) 2002-2007 by Werner Schweer and others
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License version 2.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 //=============================================================================
19 
20 #ifndef __AWLCOLORLABEL_H__
21 #define __AWLCOLORLABEL_H__
22 
23 namespace Awl {
24 
25 //---------------------------------------------------------
26 // ColorLabel
27 //---------------------------------------------------------
28 
29 class ColorLabel : public QPushButton {
30  Q_OBJECT
31  Q_PROPERTY(QColor color READ color WRITE setColor)
32 
33  QColor _color = Qt::blue;
34  QPixmap* _pixmap = nullptr;
35 
36  virtual void paintEvent(QPaintEvent*);
37 
38  signals:
39  void colorChanged(QColor);
40 
41  public slots:
42  void colorButtonClicked(bool);
43 
44  public:
45  ColorLabel(QWidget* parent = 0);
46  ~ColorLabel();
47  void setColor(const QColor& c);
48  virtual QSize sizeHint() const;
49  void setPixmap(QPixmap*);
50  QColor color() const { return _color; }
51  QPixmap* pixmap() const { return _pixmap; }
52  };
53 
54 } // namespace Awl
55 #endif
56 
QPixmap * pixmap() const
Definition: colorlabel.h:51
Definition: colorlabel.h:29
void colorButtonClicked(bool)
Definition: colorlabel.cpp:89
void setPixmap(QPixmap *)
Definition: colorlabel.cpp:54
virtual QSize sizeHint() const
Definition: colorlabel.cpp:65
void setColor(const QColor &c)
Definition: colorlabel.cpp:44
void colorChanged(QColor)
virtual void paintEvent(QPaintEvent *)
Definition: colorlabel.cpp:74
QColor color() const
Definition: colorlabel.h:50
QPixmap * _pixmap
Definition: colorlabel.h:34
QColor _color
Definition: colorlabel.h:33
Definition: aslider.cpp:23