MuseScore  3.4
Music composition and notation
icon.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2002-2011 Werner Schweer
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 // as published by the Free Software Foundation and appearing in
10 // the file LICENCE.GPL
11 //=============================================================================
12 
13 #ifndef __ICON_H__
14 #define __ICON_H__
15 
16 #include "element.h"
17 #include "mscore.h"
18 
19 namespace Ms {
20 
21 //---------------------------------------------------------
22 // Icon
23 // dummy element, used for drag&drop
24 //---------------------------------------------------------
25 
26 class Icon final : public Element {
28  QByteArray _action;
29  QIcon _icon;
30  int _extent { 40 };
31 
32  public:
33  Icon(Score* s) : Element(s) { }
34  virtual ~Icon() {}
35 
36  virtual Icon* clone() const override { return new Icon(*this); }
37  virtual ElementType type() const override { return ElementType::ICON; }
38  IconType iconType() const { return _iconType; }
39  void setIconType(IconType val) { _iconType = val; }
40  void setAction(const QByteArray& a, const QIcon& i) { _action = a; _icon = i; }
41  const QByteArray& action() const { return _action; }
42  QIcon icon() const { return _icon; }
43  void setExtent(int v) { _extent = v; }
44  int extent() const { return _extent; }
45  virtual void write(XmlWriter&) const override;
46  virtual void read(XmlReader&) override;
47  virtual void draw(QPainter*) const override;
48  virtual void layout() override;
49 
50  QVariant getProperty(Pid) const override;
51  bool setProperty(Pid, const QVariant&) override;
52  };
53 
54 
55 } // namespace Ms
56 #endif
57 
void setExtent(int v)
Definition: icon.h:43
Pid
Definition: property.h:62
Definition: xml.h:67
IconType _iconType
Definition: icon.h:27
Icon(Score *s)
Definition: icon.h:33
virtual ElementType type() const override
Definition: icon.h:37
virtual void read(XmlReader &) override
Definition: icon.cpp:36
QVariant getProperty(Pid) const override
Definition: icon.cpp:72
Base class of score layout elements.
Definition: element.h:158
virtual Icon * clone() const override
Definition: icon.h:36
Definition: icon.h:26
IconType
Definition: mscore.h:219
Definition: score.h:391
QByteArray _action
Definition: icon.h:28
IconType iconType() const
Definition: icon.h:38
const QByteArray & action() const
Definition: icon.h:41
void setIconType(IconType val)
Definition: icon.h:39
virtual void write(XmlWriter &) const override
Definition: icon.cpp:23
Definition: aeolus.cpp:26
int _extent
Definition: icon.h:30
Definition: xml.h:218
virtual void draw(QPainter *) const override
Definition: icon.cpp:62
QIcon icon() const
Definition: icon.h:42
bool setProperty(Pid, const QVariant &) override
Definition: icon.cpp:87
QIcon _icon
Definition: icon.h:29
void setAction(const QByteArray &a, const QIcon &i)
Definition: icon.h:40
ElementType
Definition: types.h:34
int extent() const
Definition: icon.h:44
virtual ~Icon()
Definition: icon.h:34
virtual void layout() override
Definition: icon.cpp:53