MuseScore  3.4
Music composition and notation
instrchange.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 __INSTRCHANGE_H__
14 #define __INSTRCHANGE_H__
15 
16 #include "text.h"
17 #include "instrument.h"
18 
19 namespace Ms {
20 
21 //---------------------------------------------------------
22 // @@ InstrumentChange
23 //---------------------------------------------------------
24 
25 class InstrumentChange final : public TextBase {
26  Instrument* _instrument; // Staff holds ownership if part of score
27 
28  public:
33 
34  virtual InstrumentChange* clone() const override { return new InstrumentChange(*this); }
35  virtual ElementType type() const override { return ElementType::INSTRUMENT_CHANGE; }
36  virtual void write(XmlWriter& xml) const override;
37  virtual void read(XmlReader&) override;
38  virtual void layout() override;
39 
40  Instrument* instrument() const { return _instrument; }
41  void setInstrument(Instrument* i) { _instrument = i; }
42  void setInstrument(Instrument&& i) { *_instrument = i; }
43  void setInstrument(const Instrument& i);
44 
45  Segment* segment() const { return toSegment(parent()); }
46 
47  virtual QVariant propertyDefault(Pid) const override;
48  };
49 
50 
51 } // namespace Ms
52 #endif
void setInstrument(Instrument *i)
Definition: instrchange.h:41
Pid
Definition: property.h:62
Definition: xml.h:67
virtual QVariant propertyDefault(Pid) const override
Definition: instrchange.cpp:116
virtual void write(XmlWriter &xml) const override
Definition: instrchange.cpp:75
Segment * segment() const
Definition: instrchange.h:45
void setInstrument(Instrument &&i)
Definition: instrchange.h:42
Instrument * instrument() const
Definition: instrchange.h:40
Definition: instrument.h:250
virtual void layout() override
Definition: instrchange.cpp:130
Element * parent() const
Definition: element.h:192
virtual ElementType type() const override
Definition: instrchange.h:35
Definition: score.h:391
Definition: textbase.h:217
Definition: segment.h:50
Definition: aeolus.cpp:26
Definition: xml.h:218
InstrumentChange(Score *)
Definition: instrchange.cpp:39
Definition: instrchange.h:25
ElementType
Definition: types.h:34
virtual InstrumentChange * clone() const override
Definition: instrchange.h:34
Instrument * _instrument
Definition: instrchange.h:26
virtual void read(XmlReader &) override
Definition: instrchange.cpp:87
~InstrumentChange()
Definition: instrchange.cpp:59