MuseScore  3.4
Music composition and notation
tremolobar.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2010-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 __TREMOLOBAR_H__
14 #define __TREMOLOBAR_H__
15 
16 #include "element.h"
17 #include "pitchvalue.h"
18 
19 namespace Ms {
20 
21 //---------------------------------------------------------
22 // @@ TremoloBar
23 //
24 // @P userMag qreal
25 // @P lineWidth qreal
26 // @P play bool play tremolo bar
27 //---------------------------------------------------------
28 
29 class TremoloBar final : public Element {
31  qreal _userMag { 1.0 }; // allowed 0.1 - 10.0
32  bool _play { true };
33 
34  QList<PitchValue> _points;
35 
36  QPolygonF polygon; // computed by layout
37 
38  public:
39  TremoloBar(Score* s);
40  virtual TremoloBar* clone() const override { return new TremoloBar(*this); }
41  virtual ElementType type() const override { return ElementType::TREMOLOBAR; }
42  virtual void layout() override;
43  virtual void draw(QPainter*) const override;
44  virtual void write(XmlWriter&) const override;
45  virtual void read(XmlReader& e) override;
46 
47  QList<PitchValue>& points() { return _points; }
48  const QList<PitchValue>& points() const { return _points; }
49  void setPoints(const QList<PitchValue>& p) { _points = p; }
50 
51  virtual QVariant getProperty(Pid propertyId) const override;
52  virtual bool setProperty(Pid propertyId, const QVariant&) override;
53  virtual QVariant propertyDefault(Pid) const override;
54 
55  qreal userMag() const { return _userMag; }
56  void setUserMag(qreal m) { _userMag = m; }
57 
58  void setLineWidth(Spatium v) { _lw = v; }
59  Spatium lineWidth() const { return _lw; }
60 
61  bool play() const { return _play; }
62  void setPlay(bool val) { _play = val; }
63  };
64 
65 
66 } // namespace Ms
67 #endif
68 
bool play() const
Definition: tremolobar.h:61
virtual void draw(QPainter *) const override
Definition: tremolobar.cpp:76
virtual QVariant propertyDefault(Pid) const override
Definition: tremolobar.cpp:175
Pid
Definition: property.h:62
Definition: xml.h:67
void setPoints(const QList< PitchValue > &p)
Definition: tremolobar.h:49
QPolygonF polygon
Definition: tremolobar.h:36
void setUserMag(qreal m)
Definition: tremolobar.h:56
virtual bool setProperty(Pid propertyId, const QVariant &) override
Definition: tremolobar.cpp:151
void setLineWidth(Spatium v)
Definition: tremolobar.h:58
Base class of score layout elements.
Definition: element.h:158
QList< PitchValue > & points()
Definition: tremolobar.h:47
qreal userMag() const
Definition: tremolobar.h:55
Definition: score.h:391
void setPlay(bool val)
Definition: tremolobar.h:62
qreal _userMag
Definition: tremolobar.h:31
const QList< PitchValue > & points() const
Definition: tremolobar.h:48
virtual void write(XmlWriter &) const override
Definition: tremolobar.cpp:87
QList< PitchValue > _points
Definition: tremolobar.h:34
Definition: tremolobar.h:29
virtual Pid propertyId(const QStringRef &xmlName) const override
Definition: element.cpp:1326
TremoloBar(Score *s)
Definition: tremolobar.cpp:35
Definition: aeolus.cpp:26
virtual void read(XmlReader &e) override
Definition: tremolobar.cpp:104
Definition: spatium.h:25
Definition: xml.h:218
virtual void layout() override
Definition: tremolobar.cpp:45
bool _play
Definition: tremolobar.h:32
Spatium lineWidth() const
Definition: tremolobar.h:59
virtual TremoloBar * clone() const override
Definition: tremolobar.h:40
ElementType
Definition: types.h:34
virtual QVariant getProperty(Pid propertyId) const override
Definition: tremolobar.cpp:133
virtual ElementType type() const override
Definition: tremolobar.h:41
Spatium _lw
Definition: tremolobar.h:30