MuseScore  3.4
Music composition and notation
ledgerline.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2013 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 __LEDGERLINE_H__
14 #define __LEDGERLINE_H__
15 
16 #include "element.h"
17 
18 namespace Ms {
19 
20 class Chord;
21 
22 //---------------------------------------------------------
23 // @@ LedgerLine
29 //---------------------------------------------------------
30 
31 class LedgerLine final : public Element {
32  qreal _width;
33  qreal _len;
35  bool vertical { false };
36 
37  public:
38  LedgerLine(Score*);
39  LedgerLine &operator=(const LedgerLine&) = delete;
40  virtual LedgerLine* clone() const override { return new LedgerLine(*this); }
41  virtual ElementType type() const override { return ElementType::LEDGER_LINE; }
42  virtual QPointF pagePos() const override;
43  Chord* chord() const { return toChord(parent()); }
44 
45  qreal len() const { return _len; }
46  qreal lineWidth() const { return _width; }
47  void setLen(qreal v) { _len = v; }
48  void setLineWidth(qreal v) { _width = v; }
49 
50  virtual void layout() override;
51  virtual void draw(QPainter*) const override;
52 
53  qreal measureXPos() const;
54  LedgerLine* next() const { return _next; }
55  void setNext(LedgerLine* l) { _next = l; }
56 
57  virtual void writeProperties(XmlWriter& xml) const override;
58  virtual bool readProperties(XmlReader&) override;
59  virtual void spatiumChanged(qreal /*oldValue*/, qreal /*newValue*/) override;
60  };
61 
62 } // namespace Ms
63 #endif
64 
void setLen(qreal v)
Definition: ledgerline.h:47
Definition: xml.h:67
virtual LedgerLine * clone() const override
Definition: ledgerline.h:40
qreal _width
Definition: ledgerline.h:32
virtual void layout() override
Definition: ledgerline.cpp:61
Base class of score layout elements.
Definition: element.h:158
LedgerLine * next() const
Definition: ledgerline.h:54
void setNext(LedgerLine *l)
Definition: ledgerline.h:55
Element * parent() const
Definition: element.h:192
LedgerLine & operator=(const LedgerLine &)=delete
Definition: score.h:391
virtual ElementType type() const override
Definition: ledgerline.h:41
Definition: aeolus.cpp:26
virtual QPointF pagePos() const override
position in page coordinates
Definition: ledgerline.cpp:38
Definition: xml.h:218
qreal lineWidth() const
Definition: ledgerline.h:46
void setLineWidth(qreal v)
Definition: ledgerline.h:48
Graphic representation of a chord.
Definition: chord.h:55
Chord * chord() const
Definition: ledgerline.h:43
virtual void writeProperties(XmlWriter &xml) const override
Definition: ledgerline.cpp:103
virtual bool readProperties(XmlReader &) override
Definition: ledgerline.cpp:115
virtual void spatiumChanged(qreal, qreal) override
Definition: ledgerline.cpp:92
LedgerLine * _next
Definition: ledgerline.h:34
Graphic representation of a ledger line.
Definition: ledgerline.h:31
ElementType
Definition: types.h:34
qreal measureXPos() const
Definition: ledgerline.cpp:49
bool vertical
Definition: ledgerline.h:35
qreal _len
Definition: ledgerline.h:33
LedgerLine(Score *)
Definition: ledgerline.cpp:27
virtual void draw(QPainter *) const override
Definition: ledgerline.cpp:77
qreal len() const
Definition: ledgerline.h:45