Merge pull request #5877 from igorkorsukov/pvs_fixes_step6

Fixed some issues from PVS-Studio report (step6)
This commit is contained in:
anatoly-os 2020-04-09 13:15:02 +03:00 committed by GitHub
commit 13a302f1af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 318 additions and 260 deletions

View file

@ -152,12 +152,12 @@ class FiguredBassItem final : public Element {
FiguredBassItem::Modifier MusicXML2Modifier(const QString prefix) const; FiguredBassItem::Modifier MusicXML2Modifier(const QString prefix) const;
// standard re-implemented virtual functions // standard re-implemented virtual functions
virtual FiguredBassItem* clone() const override { return new FiguredBassItem(*this); } FiguredBassItem* clone() const override { return new FiguredBassItem(*this); }
virtual ElementType type() const override { return ElementType::INVALID; } ElementType type() const override { return ElementType::INVALID; }
virtual void draw(QPainter* painter) const override; void draw(QPainter* painter) const override;
virtual void layout() override; void layout() override;
virtual void read(XmlReader&) override; void read(XmlReader&) override;
virtual void write(XmlWriter& xml) const override; void write(XmlWriter& xml) const override;
// read / write MusicXML // read / write MusicXML
void writeMusicXML(XmlWriter& xml, bool isOriginalFigure, int crEndTick, int fbEndTick) const; void writeMusicXML(XmlWriter& xml, bool isOriginalFigure, int crEndTick, int fbEndTick) const;
@ -200,9 +200,9 @@ class FiguredBassItem final : public Element {
QString normalizedText() const; QString normalizedText() const;
QString displayText() const { return _displayText; } QString displayText() const { return _displayText; }
virtual QVariant getProperty(Pid propertyId) const override; QVariant getProperty(Pid propertyId) const override;
virtual bool setProperty(Pid propertyId, const QVariant&) override; bool setProperty(Pid propertyId, const QVariant&) override;
virtual QVariant propertyDefault(Pid) const override; QVariant propertyDefault(Pid) const override;
}; };
//--------------------------------------------------------- //---------------------------------------------------------
@ -239,7 +239,7 @@ class FiguredBass final : public TextBase {
void layoutLines(); void layoutLines();
bool hasParentheses() const; // read / write MusicXML support bool hasParentheses() const; // read / write MusicXML support
virtual Sid getPropertyStyle(Pid) const override; Sid getPropertyStyle(Pid) const override;
public: public:
FiguredBass(Score* s = 0); FiguredBass(Score* s = 0);
@ -256,16 +256,16 @@ class FiguredBass final : public TextBase {
qreal * pSize, qreal * pLineHeight); qreal * pSize, qreal * pLineHeight);
// standard re-implemented virtual functions // standard re-implemented virtual functions
virtual FiguredBass* clone() const override { return new FiguredBass(*this); } FiguredBass* clone() const override { return new FiguredBass(*this); }
virtual ElementType type() const override { return ElementType::FIGURED_BASS; } ElementType type() const override { return ElementType::FIGURED_BASS; }
virtual void draw(QPainter* painter) const override; void draw(QPainter* painter) const override;
virtual void endEdit(EditData&) override; void endEdit(EditData&) override;
virtual void layout() override; void layout() override;
virtual void read(XmlReader&) override; void read(XmlReader&) override;
virtual void setSelected(bool f) override; void setSelected(bool f) override;
virtual void setVisible(bool f) override; void setVisible(bool f) override;
virtual void startEdit(EditData&) override; void startEdit(EditData&) override;
virtual void write(XmlWriter& xml) const override; void write(XmlWriter& xml) const override;
// read / write MusicXML // read / write MusicXML
void writeMusicXML(XmlWriter& xml, bool isOriginalFigure, int crEndTick, int fbEndTick, bool writeDuration, int divisions) const; void writeMusicXML(XmlWriter& xml, bool isOriginalFigure, int crEndTick, int fbEndTick, bool writeDuration, int divisions) const;
@ -298,9 +298,9 @@ class FiguredBass final : public TextBase {
qreal additionalContLineX(qreal pagePosY) const;// returns the X coord (in page coord) of cont. line at pagePosY, if any qreal additionalContLineX(qreal pagePosY) const;// returns the X coord (in page coord) of cont. line at pagePosY, if any
FiguredBass * nextFiguredBass() const; // returns next *adjacent* f.b. item, if any FiguredBass * nextFiguredBass() const; // returns next *adjacent* f.b. item, if any
virtual QVariant getProperty(Pid propertyId) const override; QVariant getProperty(Pid propertyId) const override;
virtual bool setProperty(Pid propertyId, const QVariant&) override; bool setProperty(Pid propertyId, const QVariant&) override;
virtual QVariant propertyDefault(Pid) const override; QVariant propertyDefault(Pid) const override;
void appendItem(FiguredBassItem* item) { items.push_back(item); } void appendItem(FiguredBassItem* item) { items.push_back(item); }
}; };

View file

@ -31,8 +31,9 @@ class InstrumentName final : public TextBase {
public: public:
InstrumentName(Score*); InstrumentName(Score*);
virtual InstrumentName* clone() const override { return new InstrumentName(*this); }
virtual ElementType type() const override { return ElementType::INSTRUMENT_NAME; } InstrumentName* clone() const override { return new InstrumentName(*this); }
ElementType type() const override { return ElementType::INSTRUMENT_NAME; }
int layoutPos() const { return _layoutPos; } int layoutPos() const { return _layoutPos; }
void setLayoutPos(int val) { _layoutPos = val; } void setLayoutPos(int val) { _layoutPos = val; }
@ -42,10 +43,10 @@ class InstrumentName final : public TextBase {
void setInstrumentNameType(InstrumentNameType v); void setInstrumentNameType(InstrumentNameType v);
void setInstrumentNameType(const QString& s); void setInstrumentNameType(const QString& s);
virtual bool isEditable() const override { return false; } bool isEditable() const override { return false; }
virtual QVariant getProperty(Pid propertyId) const override; QVariant getProperty(Pid propertyId) const override;
virtual bool setProperty(Pid propertyId, const QVariant&) override; bool setProperty(Pid propertyId, const QVariant&) override;
virtual QVariant propertyDefault(Pid) const override; QVariant propertyDefault(Pid) const override;
}; };

View file

@ -34,11 +34,13 @@ class InstrumentChange final : public TextBase {
InstrumentChange(const InstrumentChange&); InstrumentChange(const InstrumentChange&);
~InstrumentChange(); ~InstrumentChange();
virtual InstrumentChange* clone() const override { return new InstrumentChange(*this); } InstrumentChange* clone() const override { return new InstrumentChange(*this); }
virtual ElementType type() const override { return ElementType::INSTRUMENT_CHANGE; } ElementType type() const override { return ElementType::INSTRUMENT_CHANGE; }
virtual void write(XmlWriter& xml) const override;
virtual void read(XmlReader&) override; void write(XmlWriter& xml) const override;
virtual void layout() override; void read(XmlReader&) override;
void layout() override;
Instrument* instrument() const { return _instrument; } Instrument* instrument() const { return _instrument; }
void setInstrument(Instrument* i) { _instrument = i; } void setInstrument(Instrument* i) { _instrument = i; }
@ -54,9 +56,9 @@ class InstrumentChange final : public TextBase {
Segment* segment() const { return toSegment(parent()); } Segment* segment() const { return toSegment(parent()); }
virtual QVariant propertyDefault(Pid) const override; QVariant propertyDefault(Pid) const override;
virtual bool placeMultiple() const override { return false; } bool placeMultiple() const override { return false; }
}; };

View file

@ -51,16 +51,16 @@ class Jump final : public TextBase {
Type jumpType() const; Type jumpType() const;
QString jumpTypeUserName() const; QString jumpTypeUserName() const;
virtual Jump* clone() const override { return new Jump(*this); } Jump* clone() const override { return new Jump(*this); }
virtual ElementType type() const override { return ElementType::JUMP; } ElementType type() const override { return ElementType::JUMP; }
virtual int subtype() const override { return int(jumpType()); } int subtype() const override { return int(jumpType()); }
Measure* measure() const { return toMeasure(parent()); } Measure* measure() const { return toMeasure(parent()); }
virtual void read(XmlReader&) override; void read(XmlReader&) override;
virtual void write(XmlWriter& xml) const override; void write(XmlWriter& xml) const override;
virtual void layout() override; void layout() override;
QString jumpTo() const { return _jumpTo; } QString jumpTo() const { return _jumpTo; }
QString playUntil() const { return _playUntil; } QString playUntil() const { return _playUntil; }
@ -74,13 +74,13 @@ class Jump final : public TextBase {
bool playRepeats() const { return _playRepeats; } bool playRepeats() const { return _playRepeats; }
void setPlayRepeats(bool val) { _playRepeats = val; } void setPlayRepeats(bool val) { _playRepeats = val; }
virtual QVariant getProperty(Pid propertyId) const override; QVariant getProperty(Pid propertyId) const override;
virtual bool setProperty(Pid propertyId, const QVariant&) override; bool setProperty(Pid propertyId, const QVariant&) override;
virtual QVariant propertyDefault(Pid) const override; QVariant propertyDefault(Pid) const override;
Element* nextSegmentElement() override; Element* nextSegmentElement() override;
Element* prevSegmentElement() override; Element* prevSegmentElement() override;
virtual QString accessibleInfo() const override; QString accessibleInfo() const override;
}; };
//--------------------------------------------------------- //---------------------------------------------------------

View file

@ -26,10 +26,13 @@ class LetRing;
class LetRingSegment final : public TextLineBaseSegment { class LetRingSegment final : public TextLineBaseSegment {
public: public:
LetRingSegment(Spanner* sp, Score* s) : TextLineBaseSegment(sp, s, ElementFlag::MOVABLE | ElementFlag::ON_STAFF) { } LetRingSegment(Spanner* sp, Score* s) : TextLineBaseSegment(sp, s, ElementFlag::MOVABLE | ElementFlag::ON_STAFF) { }
virtual ElementType type() const override { return ElementType::LET_RING_SEGMENT; }
virtual LetRingSegment* clone() const override { return new LetRingSegment(*this); } ElementType type() const override { return ElementType::LET_RING_SEGMENT; }
LetRing* letRing() const { return (LetRing*)spanner(); } LetRingSegment* clone() const override { return new LetRingSegment(*this); }
virtual void layout() override;
LetRing* letRing() const { return (LetRing*)spanner(); }
void layout() override;
friend class LetRing; friend class LetRing;
}; };
@ -44,13 +47,16 @@ class LetRing final : public TextLineBase {
public: public:
LetRing(Score* s); LetRing(Score* s);
virtual LetRing* clone() const override { return new LetRing(*this); }
virtual ElementType type() const override { return ElementType::LET_RING; } LetRing* clone() const override { return new LetRing(*this); }
virtual void read(XmlReader&) override; ElementType type() const override { return ElementType::LET_RING; }
void read(XmlReader&) override;
// virtual void write(XmlWriter& xml) const override; // virtual void write(XmlWriter& xml) const override;
LineSegment* createLineSegment(); LineSegment* createLineSegment() override;
virtual QVariant propertyDefault(Pid propertyId) const override;
virtual Sid getPropertyStyle(Pid) const override; QVariant propertyDefault(Pid propertyId) const override;
Sid getPropertyStyle(Pid) const override;
}; };
} // namespace Ms } // namespace Ms

View file

@ -26,11 +26,12 @@ class MeasureNumber final : public TextBase {
public: public:
MeasureNumber(Score* s = 0); MeasureNumber(Score* s = 0);
virtual ElementType type() const override { return ElementType::MEASURE_NUMBER; } ElementType type() const override { return ElementType::MEASURE_NUMBER; }
virtual MeasureNumber* clone() const override { return new MeasureNumber(*this); } MeasureNumber* clone() const override { return new MeasureNumber(*this); }
virtual QVariant propertyDefault(Pid id) const override;
virtual void layout() override; QVariant propertyDefault(Pid id) const override;
void layout() override;
Measure* measure() const { return toMeasure(parent()); } Measure* measure() const { return toMeasure(parent()); }
}; };

View file

@ -32,14 +32,14 @@ class NoteLine final : public TextLineBase {
NoteLine(const NoteLine&); NoteLine(const NoteLine&);
~NoteLine() {} ~NoteLine() {}
virtual NoteLine* clone() const { return new NoteLine(*this); } NoteLine* clone() const override { return new NoteLine(*this); }
virtual ElementType type() const { return ElementType::NOTELINE; } ElementType type() const override { return ElementType::NOTELINE; }
void setStartNote(Note* n) { _startNote = n; } void setStartNote(Note* n) { _startNote = n; }
Note* startNote() const { return _startNote; } Note* startNote() const { return _startNote; }
void setEndNote(Note* n) { _endNote = n; } void setEndNote(Note* n) { _endNote = n; }
Note* endNote() const { return _endNote; } Note* endNote() const { return _endNote; }
virtual LineSegment* createLineSegment() override; LineSegment* createLineSegment() override;
}; };

View file

@ -26,8 +26,9 @@ class Ossia final : public Element {
public: public:
Ossia(Score*); Ossia(Score*);
Ossia(const Ossia&); Ossia(const Ossia&);
virtual Ossia* clone() const override { return new Ossia(*this); }
virtual ElementType type() const override { return ElementType::OSSIA; } Ossia* clone() const override { return new Ossia(*this); }
ElementType type() const override { return ElementType::OSSIA; }
}; };

View file

@ -69,16 +69,17 @@ class Ottava;
//--------------------------------------------------------- //---------------------------------------------------------
class OttavaSegment final : public TextLineBaseSegment { class OttavaSegment final : public TextLineBaseSegment {
virtual void undoChangeProperty(Pid id, const QVariant&, PropertyFlags ps) override; void undoChangeProperty(Pid id, const QVariant&, PropertyFlags ps) override;
virtual Sid getPropertyStyle(Pid) const override; Sid getPropertyStyle(Pid) const override;
public: public:
OttavaSegment(Spanner* sp, Score* s) : TextLineBaseSegment(sp, s, ElementFlag::MOVABLE | ElementFlag::ON_STAFF) { } OttavaSegment(Spanner* sp, Score* s) : TextLineBaseSegment(sp, s, ElementFlag::MOVABLE | ElementFlag::ON_STAFF) { }
virtual ElementType type() const override { return ElementType::OTTAVA_SEGMENT; }
virtual OttavaSegment* clone() const override { return new OttavaSegment(*this); } ElementType type() const override { return ElementType::OTTAVA_SEGMENT; }
Ottava* ottava() const { return (Ottava*)spanner(); } OttavaSegment* clone() const override { return new OttavaSegment(*this); }
virtual void layout() override; Ottava* ottava() const { return (Ottava*)spanner(); }
virtual Element* propertyDelegate(Pid) override; void layout() override;
Element* propertyDelegate(Pid) override;
}; };
//--------------------------------------------------------- //---------------------------------------------------------
@ -91,8 +92,8 @@ class Ottava final : public TextLineBase {
bool _numbersOnly; bool _numbersOnly;
void updateStyledProperties(); void updateStyledProperties();
virtual Sid getPropertyStyle(Pid) const override; Sid getPropertyStyle(Pid) const override;
virtual void undoChangeProperty(Pid id, const QVariant&, PropertyFlags ps) override; void undoChangeProperty(Pid id, const QVariant&, PropertyFlags ps) override;
protected: protected:
friend class OttavaSegment; friend class OttavaSegment;
@ -100,8 +101,9 @@ class Ottava final : public TextLineBase {
public: public:
Ottava(Score* s); Ottava(Score* s);
Ottava(const Ottava&); Ottava(const Ottava&);
virtual Ottava* clone() const override { return new Ottava(*this); }
virtual ElementType type() const override { return ElementType::OTTAVA; } Ottava* clone() const override { return new Ottava(*this); }
ElementType type() const override { return ElementType::OTTAVA; }
void setOttavaType(OttavaType val); void setOttavaType(OttavaType val);
OttavaType ottavaType() const { return _ottavaType; } OttavaType ottavaType() const { return _ottavaType; }
@ -111,19 +113,19 @@ class Ottava final : public TextLineBase {
void setPlacement(Placement); void setPlacement(Placement);
virtual LineSegment* createLineSegment() override; LineSegment* createLineSegment() override;
int pitchShift() const; int pitchShift() const;
virtual void write(XmlWriter& xml) const override; void write(XmlWriter& xml) const override;
virtual void read(XmlReader& de) override; void read(XmlReader& de) override;
bool readProperties(XmlReader& e); bool readProperties(XmlReader& e) override;
virtual QVariant getProperty(Pid propertyId) const override; QVariant getProperty(Pid propertyId) const override;
virtual bool setProperty(Pid propertyId, const QVariant&) override; bool setProperty(Pid propertyId, const QVariant&) override;
virtual QVariant propertyDefault(Pid) const override; QVariant propertyDefault(Pid) const override;
virtual Pid propertyId(const QStringRef& xmlName) const override; Pid propertyId(const QStringRef& xmlName) const override;
virtual QString accessibleInfo() const override; QString accessibleInfo() const override;
static const char* ottavaTypeName(OttavaType type); static const char* ottavaTypeName(OttavaType type);
}; };

View file

@ -25,14 +25,17 @@ class PalmMute;
class PalmMuteSegment final : public TextLineBaseSegment { class PalmMuteSegment final : public TextLineBaseSegment {
virtual Sid getPropertyStyle(Pid) const override; Sid getPropertyStyle(Pid) const override;
public: public:
PalmMuteSegment(Spanner* sp, Score* s) : TextLineBaseSegment(sp, s, ElementFlag::MOVABLE | ElementFlag::ON_STAFF) { } PalmMuteSegment(Spanner* sp, Score* s) : TextLineBaseSegment(sp, s, ElementFlag::MOVABLE | ElementFlag::ON_STAFF) { }
virtual ElementType type() const override { return ElementType::PALM_MUTE_SEGMENT; }
virtual PalmMuteSegment* clone() const override { return new PalmMuteSegment(*this); } ElementType type() const override { return ElementType::PALM_MUTE_SEGMENT; }
PalmMute* palmMute() const { return (PalmMute*)spanner(); } PalmMuteSegment* clone() const override { return new PalmMuteSegment(*this); }
virtual void layout() override;
PalmMute* palmMute() const { return (PalmMute*)spanner(); }
void layout() override;
friend class PalmMute; friend class PalmMute;
}; };
@ -43,19 +46,22 @@ class PalmMuteSegment final : public TextLineBaseSegment {
class PalmMute final : public TextLineBase { class PalmMute final : public TextLineBase {
virtual Sid getPropertyStyle(Pid) const override; Sid getPropertyStyle(Pid) const override;
protected: protected:
QPointF linePos(Grip, System**) const override; QPointF linePos(Grip, System**) const override;
public: public:
PalmMute(Score* s); PalmMute(Score* s);
virtual PalmMute* clone() const override { return new PalmMute(*this); }
virtual ElementType type() const override { return ElementType::PALM_MUTE; } PalmMute* clone() const override { return new PalmMute(*this); }
virtual void read(XmlReader&) override; ElementType type() const override { return ElementType::PALM_MUTE; }
void read(XmlReader&) override;
// virtual void write(XmlWriter& xml) const override; // virtual void write(XmlWriter& xml) const override;
LineSegment* createLineSegment();
virtual QVariant propertyDefault(Pid propertyId) const override; LineSegment* createLineSegment() override;
QVariant propertyDefault(Pid propertyId) const override;
friend class PalmMuteLine; friend class PalmMuteLine;
}; };

View file

@ -67,7 +67,8 @@ class Part final : public ScoreElement {
public: public:
Part(Score* = 0); Part(Score* = 0);
void initFromInstrTemplate(const InstrumentTemplate*); void initFromInstrTemplate(const InstrumentTemplate*);
virtual ElementType type() const override { return ElementType::PART; }
ElementType type() const override { return ElementType::PART; }
void read(XmlReader&); void read(XmlReader&);
bool readProperties(XmlReader&); bool readProperties(XmlReader&);

View file

@ -25,14 +25,15 @@ class Pedal;
class PedalSegment final : public TextLineBaseSegment { class PedalSegment final : public TextLineBaseSegment {
virtual Sid getPropertyStyle(Pid) const override; Sid getPropertyStyle(Pid) const override;
public: public:
PedalSegment(Spanner* sp, Score* s) : TextLineBaseSegment(sp, s, ElementFlag::MOVABLE | ElementFlag::ON_STAFF) {} PedalSegment(Spanner* sp, Score* s) : TextLineBaseSegment(sp, s, ElementFlag::MOVABLE | ElementFlag::ON_STAFF) {}
virtual ElementType type() const override { return ElementType::PEDAL_SEGMENT; }
virtual PedalSegment* clone() const override { return new PedalSegment(*this); } ElementType type() const override { return ElementType::PEDAL_SEGMENT; }
Pedal* pedal() const { return toPedal(spanner()); } PedalSegment* clone() const override { return new PedalSegment(*this); }
virtual void layout() override; Pedal* pedal() const { return toPedal(spanner()); }
void layout() override;
friend class Pedal; friend class Pedal;
}; };
@ -43,19 +44,22 @@ class PedalSegment final : public TextLineBaseSegment {
class Pedal final : public TextLineBase { class Pedal final : public TextLineBase {
virtual Sid getPropertyStyle(Pid) const override; Sid getPropertyStyle(Pid) const override;
protected: protected:
QPointF linePos(Grip, System**) const override; QPointF linePos(Grip, System**) const override;
public: public:
Pedal(Score* s); Pedal(Score* s);
virtual Pedal* clone() const override { return new Pedal(*this); }
virtual ElementType type() const override { return ElementType::PEDAL; } Pedal* clone() const override { return new Pedal(*this); }
virtual void read(XmlReader&) override; ElementType type() const override { return ElementType::PEDAL; }
virtual void write(XmlWriter& xml) const override;
LineSegment* createLineSegment(); void read(XmlReader&) override;
virtual QVariant propertyDefault(Pid propertyId) const override; void write(XmlWriter& xml) const override;
LineSegment* createLineSegment() override;
QVariant propertyDefault(Pid propertyId) const override;
friend class PedalLine; friend class PedalLine;
}; };

View file

@ -22,15 +22,16 @@ namespace Ms {
//--------------------------------------------------------- //---------------------------------------------------------
class RehearsalMark final : public TextBase { class RehearsalMark final : public TextBase {
virtual Sid getPropertyStyle(Pid) const override; Sid getPropertyStyle(Pid) const override;
public: public:
RehearsalMark(Score* score); RehearsalMark(Score* score);
virtual RehearsalMark* clone() const override { return new RehearsalMark(*this); }
virtual ElementType type() const override { return ElementType::REHEARSAL_MARK; } RehearsalMark* clone() const override { return new RehearsalMark(*this); }
Segment* segment() const { return (Segment*)parent(); } ElementType type() const override { return ElementType::REHEARSAL_MARK; }
virtual void layout() override; Segment* segment() const { return (Segment*)parent(); }
virtual QVariant propertyDefault(Pid id) const override; void layout() override;
QVariant propertyDefault(Pid id) const override;
}; };

View file

@ -36,12 +36,15 @@ class ShadowNote final : public Element {
public: public:
ShadowNote(Score*); ShadowNote(Score*);
virtual ShadowNote* clone() const { return new ShadowNote(*this); }
virtual ElementType type() const { return ElementType::SHADOW_NOTE; } ShadowNote* clone() const override { return new ShadowNote(*this); }
virtual void layout(); ElementType type() const override { return ElementType::SHADOW_NOTE; }
void layout() override;
int line() const { return _line; } int line() const { return _line; }
void setLine(int n) { _line = n; } void setLine(int n) { _line = n; }
virtual void draw(QPainter*) const;
void draw(QPainter*) const override;
void setState(SymId noteSymbol, int voice, TDuration duration, bool rest = false); void setState(SymId noteSymbol, int voice, TDuration duration, bool rest = false);

View file

@ -41,18 +41,23 @@ class Spacer final : public Element {
public: public:
Spacer(Score*); Spacer(Score*);
Spacer(const Spacer&); Spacer(const Spacer&);
virtual Spacer* clone() const { return new Spacer(*this); }
virtual ElementType type() const { return ElementType::SPACER; } Spacer* clone() const override { return new Spacer(*this); }
ElementType type() const override { return ElementType::SPACER; }
SpacerType spacerType() const { return _spacerType; } SpacerType spacerType() const { return _spacerType; }
void setSpacerType(SpacerType t) { _spacerType = t; } void setSpacerType(SpacerType t) { _spacerType = t; }
virtual void write(XmlWriter&) const; void write(XmlWriter&) const override;
virtual void read(XmlReader&); void read(XmlReader&) override;
virtual void draw(QPainter*) const;
virtual bool isEditable() const { return true; } void draw(QPainter*) const override;
virtual void startEditDrag(EditData&) override;
virtual void editDrag(EditData&) override; bool isEditable() const override { return true; }
virtual void spatiumChanged(qreal, qreal); void startEditDrag(EditData&) override;
void editDrag(EditData&) override;
void spatiumChanged(qreal, qreal) override;
void setGap(qreal sp); void setGap(qreal sp);
qreal gap() const { return _gap; } qreal gap() const { return _gap; }
@ -62,9 +67,9 @@ class Spacer final : public Element {
Grip defaultGrip() const override { return Grip::START; } Grip defaultGrip() const override { return Grip::START; }
std::vector<QPointF> gripsPositions(const EditData&) const override; std::vector<QPointF> gripsPositions(const EditData&) const override;
QVariant getProperty(Pid propertyId) const; QVariant getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const QVariant&); bool setProperty(Pid propertyId, const QVariant&) override;
QVariant propertyDefault(Pid id) const; QVariant propertyDefault(Pid id) const override;
}; };

View file

@ -105,7 +105,7 @@ class Staff final : public ScoreElement {
void initFromStaffType(const StaffType* staffType); void initFromStaffType(const StaffType* staffType);
void init(const Staff*); void init(const Staff*);
virtual ElementType type() const override { return ElementType::STAFF; } ElementType type() const override { return ElementType::STAFF; }
bool isTop() const; bool isTop() const;
QString partName() const; QString partName() const;
@ -245,9 +245,9 @@ class Staff final : public ScoreElement {
void undoSetColor(const QColor& val); void undoSetColor(const QColor& val);
void insertTime(const Fraction&, const Fraction& len); void insertTime(const Fraction&, const Fraction& len);
virtual QVariant getProperty(Pid) const override; QVariant getProperty(Pid) const override;
virtual bool setProperty(Pid, const QVariant&) override; bool setProperty(Pid, const QVariant&) override;
virtual QVariant propertyDefault(Pid) const override; QVariant propertyDefault(Pid) const override;
BracketType innerBracket() const; BracketType innerBracket() const;

View file

@ -36,26 +36,28 @@ class StaffState final : public Element {
Instrument* _instrument { nullptr }; Instrument* _instrument { nullptr };
virtual void draw(QPainter*) const; void draw(QPainter*) const override;
virtual void layout(); void layout() override;
public: public:
StaffState(Score*); StaffState(Score*);
StaffState(const StaffState&); StaffState(const StaffState&);
~StaffState(); ~StaffState();
virtual StaffState* clone() const { return new StaffState(*this); } StaffState* clone() const override { return new StaffState(*this); }
virtual ElementType type() const { return ElementType::STAFF_STATE; } ElementType type() const override { return ElementType::STAFF_STATE; }
void setStaffStateType(const QString&); void setStaffStateType(const QString&);
void setStaffStateType(StaffStateType st) { _staffStateType = st; } void setStaffStateType(StaffStateType st) { _staffStateType = st; }
StaffStateType staffStateType() const { return _staffStateType; } StaffStateType staffStateType() const { return _staffStateType; }
QString staffStateTypeName() const; QString staffStateTypeName() const;
virtual bool acceptDrop(EditData&) const override; bool acceptDrop(EditData&) const override;
virtual Element* drop(EditData&); Element* drop(EditData&) override;
virtual void write(XmlWriter&) const;
virtual void read(XmlReader&); void write(XmlWriter&) const override;
void read(XmlReader&) override;
Instrument* instrument() const { return _instrument; } Instrument* instrument() const { return _instrument; }
void setInstrument(const Instrument* i) { *_instrument = *i; } void setInstrument(const Instrument* i) { *_instrument = *i; }
void setInstrument(const Instrument&& i) { *_instrument = i; } void setInstrument(const Instrument&& i) { *_instrument = i; }

View file

@ -27,28 +27,28 @@ class StaffTypeChange final : public Element {
StaffType* _staffType { 0 }; StaffType* _staffType { 0 };
qreal lw; qreal lw;
virtual void layout() override; void layout() override;
virtual void spatiumChanged(qreal oldValue, qreal newValue) override; void spatiumChanged(qreal oldValue, qreal newValue) override;
virtual void draw(QPainter*) const override; void draw(QPainter*) const override;
public: public:
StaffTypeChange(Score* = 0); StaffTypeChange(Score* = 0);
StaffTypeChange(const StaffTypeChange&); StaffTypeChange(const StaffTypeChange&);
virtual StaffTypeChange* clone() const override { return new StaffTypeChange(*this); }
virtual ElementType type() const override { return ElementType::STAFFTYPE_CHANGE; } StaffTypeChange* clone() const override { return new StaffTypeChange(*this); }
ElementType type() const override { return ElementType::STAFFTYPE_CHANGE; }
virtual void write(XmlWriter&) const override; void write(XmlWriter&) const override;
virtual void read(XmlReader&) override; void read(XmlReader&) override;
const StaffType* staffType() const { return _staffType; } const StaffType* staffType() const { return _staffType; }
void setStaffType(StaffType* st) { _staffType = st; } void setStaffType(StaffType* st) { _staffType = st; }
Measure* measure() const { return toMeasure(parent()); } Measure* measure() const { return toMeasure(parent()); }
virtual QVariant getProperty(Pid propertyId) const override; QVariant getProperty(Pid propertyId) const override;
virtual bool setProperty(Pid propertyId, const QVariant&) override; bool setProperty(Pid propertyId, const QVariant&) override;
virtual QVariant propertyDefault(Pid) const override; QVariant propertyDefault(Pid) const override;
}; };

View file

@ -30,19 +30,21 @@ namespace Ms {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class Sticking final : public TextBase { class Sticking final : public TextBase {
virtual Sid getPropertyStyle(Pid) const override; Sid getPropertyStyle(Pid) const override;
virtual QVariant propertyDefault(Pid id) const override; QVariant propertyDefault(Pid id) const override;
public: public:
Sticking(Score*); Sticking(Score*);
virtual Sticking* clone() const override { return new Sticking(*this); }
virtual ElementType type() const override { return ElementType::STICKING; }
Segment* segment() const { return (Segment*)parent(); }
Measure* measure() const { return (Measure*)parent()->parent(); }
virtual void layout() override; Sticking* clone() const override { return new Sticking(*this); }
virtual void write(XmlWriter& xml) const override; ElementType type() const override { return ElementType::STICKING; }
virtual void read(XmlReader&) override;
Segment* segment() const { return (Segment*)parent(); }
Measure* measure() const { return (Measure*)parent()->parent(); }
void layout() override;
void write(XmlWriter& xml) const override;
void read(XmlReader&) override;
}; };
} // namespace Ms } // namespace Ms

View file

@ -33,19 +33,21 @@ class SystemDivider final : public Symbol {
SystemDivider(Score* s = 0); SystemDivider(Score* s = 0);
SystemDivider(const SystemDivider&); SystemDivider(const SystemDivider&);
virtual SystemDivider* clone() const override { return new SystemDivider(*this); } SystemDivider* clone() const override { return new SystemDivider(*this); }
virtual ElementType type() const override { return ElementType::SYSTEM_DIVIDER; } ElementType type() const override { return ElementType::SYSTEM_DIVIDER; }
Type dividerType() const { return _dividerType; } Type dividerType() const { return _dividerType; }
void setDividerType(Type v); void setDividerType(Type v);
virtual QRectF drag(EditData&) override; QRectF drag(EditData&) override;
virtual void write(XmlWriter&) const override;
virtual void read(XmlReader&) override;
virtual void layout() override;
virtual Segment* segment() const override { return 0; } void write(XmlWriter&) const override;
System* system() const { return (System*)parent(); } void read(XmlReader&) override;
void layout() override;
Segment* segment() const override { return nullptr; }
System* system() const { return (System*)parent(); }
}; };
} // namespace Ms } // namespace Ms

View file

@ -22,16 +22,16 @@ namespace Ms {
//--------------------------------------------------------- //---------------------------------------------------------
class SystemText final : public StaffTextBase { class SystemText final : public StaffTextBase {
virtual void layout() override; void layout() override;
virtual Sid getPropertyStyle(Pid) const override; Sid getPropertyStyle(Pid) const override;
virtual QVariant propertyDefault(Pid id) const override; QVariant propertyDefault(Pid id) const override;
public: public:
SystemText(Score* = 0, Tid = Tid::SYSTEM); SystemText(Score* = 0, Tid = Tid::SYSTEM);
virtual SystemText* clone() const override { return new SystemText(*this); } SystemText* clone() const override { return new SystemText(*this); }
virtual ElementType type() const override { return ElementType::SYSTEM_TEXT; } ElementType type() const override { return ElementType::SYSTEM_TEXT; }
Segment* segment() const { return (Segment*)parent(); } Segment* segment() const { return (Segment*)parent(); }
}; };

View file

@ -25,14 +25,16 @@ class Note;
class TextLineSegment final : public TextLineBaseSegment { class TextLineSegment final : public TextLineBaseSegment {
virtual Sid getPropertyStyle(Pid) const override; Sid getPropertyStyle(Pid) const override;
public: public:
TextLineSegment(Spanner* sp, Score* s); TextLineSegment(Spanner* sp, Score* s);
virtual ElementType type() const override { return ElementType::TEXTLINE_SEGMENT; }
virtual TextLineSegment* clone() const override { return new TextLineSegment(*this); } ElementType type() const override { return ElementType::TEXTLINE_SEGMENT; }
TextLine* textLine() const { return toTextLine(spanner()); } TextLineSegment* clone() const override { return new TextLineSegment(*this); }
virtual void layout() override;
TextLine* textLine() const { return toTextLine(spanner()); }
void layout() override;
}; };
//--------------------------------------------------------- //---------------------------------------------------------
@ -41,18 +43,20 @@ class TextLineSegment final : public TextLineBaseSegment {
class TextLine final : public TextLineBase { class TextLine final : public TextLineBase {
virtual Sid getPropertyStyle(Pid) const override; Sid getPropertyStyle(Pid) const override;
public: public:
TextLine(Score* s); TextLine(Score* s);
TextLine(const TextLine&); TextLine(const TextLine&);
~TextLine() {} ~TextLine() {}
virtual TextLine* clone() const { return new TextLine(*this); } TextLine* clone() const override { return new TextLine(*this); }
virtual ElementType type() const { return ElementType::TEXTLINE; } ElementType type() const override { return ElementType::TEXTLINE; }
virtual void write(XmlWriter&) const override;
virtual LineSegment* createLineSegment() override; void write(XmlWriter&) const override;
virtual QVariant propertyDefault(Pid) const override;
LineSegment* createLineSegment() override;
QVariant propertyDefault(Pid) const override;
}; };

View file

@ -37,20 +37,23 @@ class TremoloBar final : public Element {
public: public:
TremoloBar(Score* s); TremoloBar(Score* s);
virtual TremoloBar* clone() const override { return new TremoloBar(*this); }
virtual ElementType type() const override { return ElementType::TREMOLOBAR; } TremoloBar* clone() const override { return new TremoloBar(*this); }
virtual void layout() override; ElementType type() const override { return ElementType::TREMOLOBAR; }
virtual void draw(QPainter*) const override;
virtual void write(XmlWriter&) const override; void layout() override;
virtual void read(XmlReader& e) override; void draw(QPainter*) const override;
void write(XmlWriter&) const override;
void read(XmlReader& e) override;
QList<PitchValue>& points() { return _points; } QList<PitchValue>& points() { return _points; }
const QList<PitchValue>& points() const { return _points; } const QList<PitchValue>& points() const { return _points; }
void setPoints(const QList<PitchValue>& p) { _points = p; } void setPoints(const QList<PitchValue>& p) { _points = p; }
virtual QVariant getProperty(Pid propertyId) const override; QVariant getProperty(Pid propertyId) const override;
virtual bool setProperty(Pid propertyId, const QVariant&) override; bool setProperty(Pid propertyId, const QVariant&) override;
virtual QVariant propertyDefault(Pid) const override; QVariant propertyDefault(Pid) const override;
qreal userMag() const { return _userMag; } qreal userMag() const { return _userMag; }
void setUserMag(qreal m) { _userMag = m; } void setUserMag(qreal m) { _userMag = m; }

View file

@ -29,25 +29,26 @@ class TrillSegment final : public LineSegment {
void symbolLine(SymId start, SymId fill); void symbolLine(SymId start, SymId fill);
void symbolLine(SymId start, SymId fill, SymId end); void symbolLine(SymId start, SymId fill, SymId end);
virtual Sid getPropertyStyle(Pid) const override; Sid getPropertyStyle(Pid) const override;
protected: protected:
public: public:
TrillSegment(Spanner* sp, Score* s) : LineSegment(sp, s, ElementFlag::MOVABLE | ElementFlag::ON_STAFF) {} TrillSegment(Spanner* sp, Score* s) : LineSegment(sp, s, ElementFlag::MOVABLE | ElementFlag::ON_STAFF) {}
TrillSegment(Score* s) : LineSegment(s, ElementFlag::MOVABLE | ElementFlag::ON_STAFF) {} TrillSegment(Score* s) : LineSegment(s, ElementFlag::MOVABLE | ElementFlag::ON_STAFF) {}
Trill* trill() const { return (Trill*)spanner(); }
virtual ElementType type() const override { return ElementType::TRILL_SEGMENT; }
virtual TrillSegment* clone() const override { return new TrillSegment(*this); }
virtual void draw(QPainter*) const override;
virtual bool acceptDrop(EditData&) const override;
virtual Element* drop(EditData&) override;
virtual void layout() override;
virtual Element* propertyDelegate(Pid) override; Trill* trill() const { return (Trill*)spanner(); }
ElementType type() const override { return ElementType::TRILL_SEGMENT; }
TrillSegment* clone() const override { return new TrillSegment(*this); }
void draw(QPainter*) const override;
bool acceptDrop(EditData&) const override;
Element* drop(EditData&) override;
void layout() override;
virtual void add(Element*) override; Element* propertyDelegate(Pid) override;
virtual void remove(Element*) override;
virtual void scanElements(void* data, void (*func)(void*, Element*), bool all) override; void add(Element*) override;
void remove(Element*) override;
void scanElements(void* data, void (*func)(void*, Element*), bool all) override;
Shape shape() const override; Shape shape() const override;
std::vector<SymId> symbols() const { return _symbols; } std::vector<SymId> symbols() const { return _symbols; }
@ -60,7 +61,7 @@ class TrillSegment final : public LineSegment {
//--------------------------------------------------------- //---------------------------------------------------------
class Trill final : public SLine { class Trill final : public SLine {
virtual Sid getPropertyStyle(Pid) const override; Sid getPropertyStyle(Pid) const override;
public: public:
enum class Type : char { enum class Type : char {
@ -75,16 +76,17 @@ class Trill final : public SLine {
public: public:
Trill(Score* s); Trill(Score* s);
virtual ~Trill(); ~Trill();
virtual Trill* clone() const override { return new Trill(*this); }
virtual ElementType type() const override { return ElementType::TRILL; }
virtual void layout() override; Trill* clone() const override { return new Trill(*this); }
virtual LineSegment* createLineSegment() override; ElementType type() const override { return ElementType::TRILL; }
virtual void add(Element*) override;
virtual void remove(Element*) override; void layout() override;
virtual void write(XmlWriter&) const override; LineSegment* createLineSegment() override;
virtual void read(XmlReader&) override; void add(Element*) override;
void remove(Element*) override;
void write(XmlWriter&) const override;
void read(XmlReader&) override;
void setTrillType(const QString& s); void setTrillType(const QString& s);
void setTrillType(Type tt) { _trillType = tt; } void setTrillType(Type tt) { _trillType = tt; }
@ -100,14 +102,14 @@ class Trill final : public SLine {
void setAccidental(Accidental* a) { _accidental = a; } void setAccidental(Accidental* a) { _accidental = a; }
Segment* segment() const { return (Segment*)parent(); } Segment* segment() const { return (Segment*)parent(); }
virtual void scanElements(void* data, void (*func)(void*, Element*), bool all=true) override; void scanElements(void* data, void (*func)(void*, Element*), bool all=true) override;
virtual QVariant getProperty(Pid propertyId) const override; QVariant getProperty(Pid propertyId) const override;
virtual bool setProperty(Pid propertyId, const QVariant&) override; bool setProperty(Pid propertyId, const QVariant&) override;
virtual QVariant propertyDefault(Pid) const override; QVariant propertyDefault(Pid) const override;
virtual Pid propertyId(const QStringRef& xmlName) const override; Pid propertyId(const QStringRef& xmlName) const override;
virtual QString accessibleInfo() const override; QString accessibleInfo() const override;
}; };
struct TrillTableItem { struct TrillTableItem {

View file

@ -34,13 +34,16 @@ class VibratoSegment final : public LineSegment {
protected: protected:
public: public:
VibratoSegment(Spanner* sp, Score* s) : LineSegment(sp, s, ElementFlag::MOVABLE | ElementFlag::ON_STAFF) {} VibratoSegment(Spanner* sp, Score* s) : LineSegment(sp, s, ElementFlag::MOVABLE | ElementFlag::ON_STAFF) {}
Vibrato* vibrato() const { return toVibrato(spanner()); }
virtual ElementType type() const override { return ElementType::VIBRATO_SEGMENT; }
virtual VibratoSegment* clone() const override { return new VibratoSegment(*this); }
virtual void draw(QPainter*) const override;
virtual void layout() override;
virtual Element* propertyDelegate(Pid) override; ElementType type() const override { return ElementType::VIBRATO_SEGMENT; }
VibratoSegment* clone() const override { return new VibratoSegment(*this); }
Vibrato* vibrato() const { return toVibrato(spanner()); }
void draw(QPainter*) const override;
void layout() override;
Element* propertyDelegate(Pid) override;
Shape shape() const override; Shape shape() const override;
std::vector<SymId> symbols() const { return _symbols; } std::vector<SymId> symbols() const { return _symbols; }
@ -53,7 +56,7 @@ class VibratoSegment final : public LineSegment {
class Vibrato final : public SLine { class Vibrato final : public SLine {
virtual Sid getPropertyStyle(Pid) const override; Sid getPropertyStyle(Pid) const override;
public: public:
enum class Type : char { enum class Type : char {
@ -65,14 +68,16 @@ class Vibrato final : public SLine {
public: public:
Vibrato(Score* s); Vibrato(Score* s);
virtual ~Vibrato(); ~Vibrato();
virtual Vibrato* clone() const override { return new Vibrato(*this); }
virtual ElementType type() const override { return ElementType::VIBRATO; }
virtual void layout() override; Vibrato* clone() const override { return new Vibrato(*this); }
virtual LineSegment* createLineSegment() override; ElementType type() const override { return ElementType::VIBRATO; }
virtual void write(XmlWriter&) const override;
virtual void read(XmlReader&) override; void layout() override;
LineSegment* createLineSegment() override;
void write(XmlWriter&) const override;
void read(XmlReader&) override;
void setVibratoType(const QString& s); void setVibratoType(const QString& s);
void undoSetVibratoType(Type val); void undoSetVibratoType(Type val);
@ -86,11 +91,11 @@ class Vibrato final : public SLine {
Segment* segment() const { return (Segment*)parent(); } Segment* segment() const { return (Segment*)parent(); }
virtual QVariant getProperty(Pid propertyId) const override; QVariant getProperty(Pid propertyId) const override;
virtual bool setProperty(Pid propertyId, const QVariant&) override; bool setProperty(Pid propertyId, const QVariant&) override;
virtual QVariant propertyDefault(Pid) const override; QVariant propertyDefault(Pid) const override;
virtual Pid propertyId(const QStringRef& xmlName) const override; Pid propertyId(const QStringRef& xmlName) const override;
virtual QString accessibleInfo() const override; QString accessibleInfo() const override;
}; };
//--------------------------------------------------------- //---------------------------------------------------------

View file

@ -32,12 +32,14 @@ extern LineSegment* voltaDebug;
class VoltaSegment final : public TextLineBaseSegment { class VoltaSegment final : public TextLineBaseSegment {
public: public:
VoltaSegment(Spanner*, Score*); VoltaSegment(Spanner*, Score*);
virtual ElementType type() const override { return ElementType::VOLTA_SEGMENT; }
virtual VoltaSegment* clone() const override { return new VoltaSegment(*this); }
Volta* volta() const { return (Volta*)spanner(); }
virtual void layout() override;
virtual Element* propertyDelegate(Pid) override; ElementType type() const override { return ElementType::VOLTA_SEGMENT; }
VoltaSegment* clone() const override { return new VoltaSegment(*this); }
Volta* volta() const { return (Volta*)spanner(); }
void layout() override;
Element* propertyDelegate(Pid) override;
}; };
//--------------------------------------------------------- //---------------------------------------------------------
@ -55,14 +57,17 @@ class Volta final : public TextLineBase {
}; };
Volta(Score* s); Volta(Score* s);
virtual Volta* clone() const override { return new Volta(*this); }
virtual ElementType type() const override { return ElementType::VOLTA; }
virtual LineSegment* createLineSegment() override;
virtual void write(XmlWriter&) const override; Volta* clone() const override { return new Volta(*this); }
virtual void read(XmlReader& e) override; ElementType type() const override { return ElementType::VOLTA; }
LineSegment* createLineSegment() override;
void write(XmlWriter&) const override;
void read(XmlReader& e) override;
bool readProperties(XmlReader&) override; bool readProperties(XmlReader&) override;
virtual SpannerSegment* layoutSystem(System* system) override; SpannerSegment* layoutSystem(System* system) override;
void setVelocity() const; void setVelocity() const;
void setChannel() const; void setChannel() const;
@ -79,11 +84,11 @@ class Volta final : public TextLineBase {
void setVoltaType(Volta::Type); // deprecated void setVoltaType(Volta::Type); // deprecated
Type voltaType() const; // deprecated Type voltaType() const; // deprecated
virtual QVariant getProperty(Pid propertyId) const override; QVariant getProperty(Pid propertyId) const override;
virtual bool setProperty(Pid propertyId, const QVariant&) override; bool setProperty(Pid propertyId, const QVariant&) override;
virtual QVariant propertyDefault(Pid) const override; QVariant propertyDefault(Pid) const override;
virtual QString accessibleInfo() const override; QString accessibleInfo() const override;
}; };
} // namespace Ms } // namespace Ms