MuseScore  3.4
Music composition and notation
qmliconview.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2019 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 __QMLICONVIEW_H__
21 #define __QMLICONVIEW_H__
22 
23 namespace Ms {
24 
25 //---------------------------------------------------------
26 // QmlIconView
27 //---------------------------------------------------------
28 
29 class QmlIconView : public QQuickPaintedItem {
30  Q_OBJECT
31 
32  QColor _color;
33  QIcon _icon;
34  bool _selected;
35  bool _active = false;
36 
37  Q_PROPERTY(QVariant icon READ icon WRITE setIcon)
38  Q_PROPERTY(bool selected READ selected WRITE setSelected)
39  Q_PROPERTY(bool active READ active WRITE setActive)
40 
41  public:
42  QmlIconView(QQuickItem* parent = nullptr)
43  : QQuickPaintedItem(parent) {}
44 
45  QVariant icon() const { return QVariant::fromValue(_icon); }
46  void setIcon(QVariant val);
47 
48  bool selected() const { return _selected; }
49  void setSelected(bool val) { _selected = val; update(); }
50 
51  bool active() const { return _active; }
52  void setActive(bool val) { _active = val; update(); }
53 
54  void paint(QPainter*) override;
55  };
56 
57 } // namespace Ms
58 #endif
QIcon _icon
Definition: qmliconview.h:33
QVariant icon() const
Definition: qmliconview.h:45
Definition: qmliconview.h:29
Definition: aeolus.cpp:26
void setSelected(bool val)
Definition: qmliconview.h:49
void setIcon(QVariant val)
Definition: qmliconview.cpp:44
void paint(QPainter *) override
Definition: qmliconview.cpp:28
bool _active
Definition: qmliconview.h:35
bool selected() const
Definition: qmliconview.h:48
void setActive(bool val)
Definition: qmliconview.h:52
bool active() const
Definition: qmliconview.h:51
bool _selected
Definition: qmliconview.h:34
QColor _color
Definition: qmliconview.h:32