MuseScore  3.4
Music composition and notation
spacer.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2008-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 __SPACER_H__
14 #define __SPACER_H__
15 
16 #include "element.h"
17 
18 namespace Ms {
19 
20 //---------------------------------------------------------
21 // SpacerType
22 //---------------------------------------------------------
23 
24 enum class SpacerType : char {
25  UP, DOWN, FIXED
26  };
27 
28 //-------------------------------------------------------------------
29 // @@ Spacer
31 //-------------------------------------------------------------------
32 
33 class Spacer final : public Element {
35  qreal _gap;
36 
37  QPainterPath path;
38 
39  void layout0();
40 
41  public:
42  Spacer(Score*);
43  Spacer(const Spacer&);
44  virtual Spacer* clone() const { return new Spacer(*this); }
45  virtual ElementType type() const { return ElementType::SPACER; }
46  SpacerType spacerType() const { return _spacerType; }
47  void setSpacerType(SpacerType t) { _spacerType = t; }
48 
49  virtual void write(XmlWriter&) const;
50  virtual void read(XmlReader&);
51  virtual void draw(QPainter*) const;
52  virtual bool isEditable() const { return true; }
53  virtual void startEditDrag(EditData&) override;
54  virtual void editDrag(EditData&) override;
55  virtual void spatiumChanged(qreal, qreal);
56  void setGap(qreal sp);
57  qreal gap() const { return _gap; }
58 
59  EditBehavior normalModeEditBehavior() const override { return EditBehavior::Edit; }
60  int gripsCount() const override { return 1; }
61  Grip initialEditModeGrip() const override { return Grip::START; }
62  Grip defaultGrip() const override { return Grip::START; }
63  std::vector<QPointF> gripsPositions(const EditData&) const override;
64 
65  QVariant getProperty(Pid propertyId) const;
66  bool setProperty(Pid propertyId, const QVariant&);
67  QVariant propertyDefault(Pid id) const;
68  };
69 
70 
71 } // namespace Ms
72 #endif
int gripsCount() const override
Definition: spacer.h:60
Pid
Definition: property.h:62
SpacerType spacerType() const
Definition: spacer.h:46
Definition: xml.h:67
virtual bool isEditable() const
Definition: spacer.h:52
virtual Spacer * clone() const
Definition: spacer.h:44
Grip initialEditModeGrip() const override
Definition: spacer.h:61
Grip defaultGrip() const override
Definition: spacer.h:62
qreal _gap
Definition: spacer.h:35
Base class of score layout elements.
Definition: element.h:158
SpacerType _spacerType
Definition: spacer.h:34
Definition: score.h:391
Vertical spacer element to adjust the distance of staves.
Definition: spacer.h:33
Grip
Definition: element.h:43
QPainterPath path
Definition: spacer.h:37
Definition: aeolus.cpp:26
SpacerType
Definition: spacer.h:24
Definition: xml.h:218
qreal gap() const
Definition: spacer.h:57
void setSpacerType(SpacerType t)
Definition: spacer.h:47
Definition: element.h:111
virtual ElementType type() const
Definition: spacer.h:45
ElementType
Definition: types.h:34
Pid propertyId(const QStringRef &s)
Definition: property.cpp:347
EditBehavior
Definition: element.h:173
EditBehavior normalModeEditBehavior() const override
Definition: spacer.h:59