24 #define CONTROL_MODIFIER Qt::AltModifier 26 #define CONTROL_MODIFIER Qt::ControlModifier 126 bool hRaster {
false };
127 bool vRaster {
false };
130 Qt::KeyboardModifiers modifiers { 0 };
133 Qt::MouseButtons buttons { Qt::NoButton };
145 bool control(
bool textEditing =
false)
const;
146 bool shift()
const {
return modifiers & Qt::ShiftModifier; }
189 Q_INVOKABLE
virtual Ms::Element* clone()
const = 0;
190 virtual Element* linkedClone();
195 const Measure* findMeasure()
const;
199 virtual bool isElement()
const override {
return true; }
204 inline void setFlag(
ElementFlag f,
bool v)
const {
if (v) _flags |= f;
else _flags &= ~ElementFlags(f); }
227 void setOffsetChanged(
bool v,
bool absolute =
true,
const QPointF& diff = QPointF());
229 const QPointF&
ipos()
const {
return _pos; }
230 virtual const QPointF
pos()
const {
return _pos + _offset; }
231 virtual qreal
x()
const {
return _pos.x() + _offset.x(); }
232 virtual qreal
y()
const {
return _pos.y() + _offset.y(); }
233 void setPos(qreal x, qreal y) { _pos.rx() = x, _pos.ry() = y; }
234 void setPos(
const QPointF& p) { _pos = p; }
235 QPointF&
rpos() {
return _pos; }
236 qreal&
rxpos() {
return _pos.rx(); }
237 qreal&
rypos() {
return _pos.ry(); }
238 virtual void move(
const QPointF& s) { _pos += s; }
240 virtual QPointF pagePos()
const;
241 virtual QPointF canvasPos()
const;
243 qreal canvasX()
const;
245 const QPointF&
offset()
const {
return _offset; }
246 virtual void setOffset(
const QPointF& o) { _offset = o; }
247 void setOffset(qreal x, qreal y) { _offset.rx() = x, _offset.ry() = y; }
255 bool isNudged()
const {
return !_offset.isNull(); }
257 virtual const QRectF&
bbox()
const {
return _bbox; }
258 virtual QRectF&
bbox() {
return _bbox; }
259 virtual qreal
height()
const {
return bbox().height(); }
261 virtual qreal
width()
const {
return bbox().width(); }
262 virtual void setWidth(qreal v) { _bbox.setWidth(v); }
263 QRectF
abbox()
const {
return bbox().translated(pagePos()); }
266 virtual void setbbox(
const QRectF& r)
const { _bbox = r; }
267 virtual void addbbox(
const QRectF& r)
const { _bbox |= r; }
268 bool contains(
const QPointF& p)
const;
269 bool intersects(
const QRectF& r)
const;
273 virtual Shape shape()
const {
return Shape(bbox()); }
275 virtual qreal
baseLine()
const {
return -height(); }
279 virtual void draw(QPainter*)
const {}
280 void drawAt(QPainter*p,
const QPointF& pt)
const { p->translate(pt); draw(p); p->translate(-pt);}
282 virtual void writeProperties(
XmlWriter& xml)
const;
297 virtual void startEditDrag(
EditData&);
299 virtual void endEditDrag(
EditData&);
306 virtual bool nextGrip(
EditData&)
const;
307 virtual bool prevGrip(
EditData&)
const;
316 int track()
const {
return _track; }
320 void setZ(
int val) { _z = val; }
324 int voice()
const {
return _track & 3; }
326 Staff* staff()
const;
335 virtual void spatiumChanged(qreal , qreal );
336 virtual void localSpatiumChanged(qreal , qreal );
339 virtual void dump()
const;
340 virtual Q_INVOKABLE QString subtypeName()
const;
343 virtual Q_INVOKABLE QString
_name()
const {
return QString(name()); }
345 virtual QColor
color()
const {
return _color; }
346 QColor curColor()
const;
347 QColor curColor(
bool isVisible)
const;
348 QColor curColor(
bool isVisible, QColor normalColor)
const;
349 virtual void setColor(
const QColor& c) { _color = c; }
350 void undoSetColor(
const QColor& c);
351 void undoSetVisible(
bool v);
356 virtual QByteArray mimeData(
const QPointF&)
const;
383 mutable bool itemDiscovered {
false };
385 virtual void scanElements(
void* data,
void (*func)(
void*,
Element*),
bool all=
true);
387 virtual void reset()
override;
389 virtual qreal
mag()
const {
return _mag; }
393 bool isPrintable()
const;
397 static Element* name2Element(
const QStringRef&,
Score*);
422 uint
tag()
const {
return _tag; }
425 bool autoplace()
const;
429 virtual QVariant getProperty(
Pid)
const override;
430 virtual bool setProperty(
Pid,
const QVariant&)
override;
431 virtual void undoChangeProperty(
Pid id,
const QVariant&,
PropertyFlags ps)
override;
433 virtual QVariant propertyDefault(
Pid)
const override;
434 virtual Pid propertyId(
const QStringRef& xmlName)
const override;
435 virtual QString propertyUserValue(
Pid)
const override;
438 bool custom(
Pid)
const;
439 virtual bool isUserModified()
const;
441 void drawSymbol(
SymId id, QPainter* p,
const QPointF& o = QPointF(), qreal scale = 1.0)
const;
442 void drawSymbol(
SymId id, QPainter* p,
const QPointF& o,
int n)
const;
443 void drawSymbols(
const std::vector<SymId>&, QPainter* p,
const QPointF& o = QPointF(), qreal scale = 1.0)
const;
444 void drawSymbols(
const std::vector<SymId>&, QPainter* p,
const QPointF& o,
const QSizeF& scale)
const;
445 qreal symHeight(
SymId id)
const;
446 qreal symWidth(
SymId id)
const;
447 qreal symWidth(
const std::vector<SymId>&)
const;
448 QRectF symBbox(
SymId id)
const;
449 QRectF symBbox(
const std::vector<SymId>&)
const;
450 QPointF symStemDownNW(
SymId id)
const;
451 QPointF symStemUpSE(
SymId id)
const;
452 QPointF symCutOutNE(
SymId id)
const;
453 QPointF symCutOutNW(
SymId id)
const;
454 QPointF symCutOutSE(
SymId id)
const;
455 QPointF symCutOutSW(
SymId id)
const;
456 qreal symAdvance(
SymId id)
const;
457 bool symIsValid(
SymId id)
const;
460 virtual Element* nextElement();
461 virtual Element* prevElement();
462 virtual Element* nextSegmentElement();
463 virtual Element* prevSegmentElement();
465 virtual QString accessibleInfo()
const;
467 return accessibleInfo();
474 virtual void triggerLayout()
const;
475 virtual void triggerLayoutAll()
const;
476 virtual void drawEditMode(QPainter*,
EditData&);
478 void autoplaceSegmentElement(
bool above,
bool add);
479 void autoplaceMeasureElement(
bool above,
bool add);
482 void autoplaceCalculateOffset(QRectF& r, qreal minDistance);
483 qreal rebaseOffset(
bool nox =
true);
484 bool rebaseMinDistance(qreal& md, qreal& yd, qreal sp, qreal rebase,
bool above,
bool fix);
486 qreal styleP(
Sid idx)
const;
523 void write(
XmlWriter&,
const char* name)
const;
541 virtual void draw(QPainter*)
const;
542 virtual void addElement(
Element*, qreal x, qreal y);
544 virtual void setSelected(
bool f);
545 virtual void setVisible(
bool);
546 virtual void layout();
ElementList()
Definition: element.h:519
virtual void setWidth(qreal v)
Definition: element.h:262
virtual bool acceptDrop(EditData &) const
Return true if this element accepts a drop at canvas relative pos of given element type and subtype...
Definition: element.h:364
int voice() const
Definition: element.h:324
void setDropTarget(bool v) const
Definition: element.h:412
QPoint startMovePixel
Definition: element.h:123
void drawAt(QPainter *p, const QPointF &pt) const
Definition: element.h:280
virtual void editCopy(EditData &)
Definition: element.h:303
virtual qreal mag() const
Definition: element.h:389
virtual int gripsCount() const
Definition: element.h:311
int _track
staffIdx * VOICES + voice
Definition: element.h:167
Global staff data not directly related to drawing.
Definition: staff.h:62
Pid
Definition: property.h:62
Virtual base class for Measure, HBox and VBox.
Definition: measurebase.h:61
bool trailer() const
Definition: element.h:405
QList< PropertyData > propertyData
Definition: element.h:507
QPointF lastPos
Definition: element.h:124
uint _tag
tag bitmask
Definition: element.h:170
virtual void undoChangeProperty(Pid id, const QVariant &, PropertyFlags ps)
Definition: scoreElement.cpp:291
int staffIdx() const
Definition: element.h:322
Pid id
Definition: element.h:499
OffsetChange
Definition: element.h:56
void setSizeIsSpatiumDependent(bool v)
Definition: element.h:214
OffsetChange offsetChanged() const
Definition: element.h:226
QFlags< ElementFlag > ElementFlags
Definition: element.h:101
virtual int vStaffIdx() const
Definition: element.h:323
QColor _color
element color attribute
Definition: element.h:180
Placement placement() const
Definition: element.h:216
virtual void editCut(EditData &)
Definition: element.h:302
QRectF _bbox
Bounding box relative to _pos + _offset.
Definition: element.h:160
one measure in a system
Definition: measure.h:65
virtual EditBehavior normalModeEditBehavior() const
Definition: element.h:310
void setComposition(bool v) const
Definition: element.h:415
virtual bool isElement() const override
Definition: element.h:199
void setZ(int val)
Definition: element.h:320
void setGenerated(bool val)
Definition: element.h:222
virtual bool isMovable() const
Definition: element.h:417
Definition: scoreElement.h:173
virtual Element * propertyDelegate(Pid)
Definition: element.h:436
Definition: element.h:504
void setMinDistance(Spatium v)
Definition: element.h:225
virtual void setTrack(int val)
Definition: element.h:317
SymId
Definition: sym.h:30
Base class of score layout elements.
Definition: element.h:158
virtual QPointF gripAnchor(Grip) const
Definition: element.h:308
Definition: element.h:530
void setTag(uint val)
Definition: element.h:423
Definition: element.h:517
int track() const
Definition: element.h:316
void setHeader(bool v)
Definition: element.h:403
qreal & rxpos()
Definition: element.h:236
virtual QString accessibleExtraInfo() const
Definition: element.h:470
Element * parent() const
Definition: element.h:192
virtual const QPointF pos() const
Definition: element.h:230
QPointF pos
Definition: element.h:121
virtual void setSelected(bool f)
Definition: element.h:208
bool composition() const
Definition: element.h:414
virtual qreal height() const
Definition: element.h:259
virtual Grip defaultGrip() const
Definition: element.h:313
virtual std::vector< QPointF > gripsPositions(const EditData &) const
Definition: element.h:314
virtual QLineF dragAnchor() const
Definition: element.h:291
bool placeAbove() const
Definition: element.h:218
PropertyFlags
Definition: property.h:54
constexpr qreal val() const
Definition: spatium.h:32
qreal & rypos()
Definition: element.h:237
void setParent(Element *e)
Definition: element.h:193
QPointF & rpos()
Definition: element.h:235
QRectF abbox() const
Definition: element.h:263
Spatium minDistance() const
Definition: element.h:224
bool placeBelow() const
Definition: element.h:219
QPointF _changedPos
position set when changing offset
Definition: element.h:165
#define VOICES
Definition: mscore.h:72
Placement
Definition: types.h:312
virtual void setHeight(qreal v)
Definition: element.h:260
void setMag(qreal val)
Definition: element.h:390
virtual qreal width() const
Definition: element.h:261
bool selectable() const
Definition: element.h:408
void setFlag(ElementFlag f, bool v)
Definition: element.h:203
Grip
Definition: element.h:43
virtual void addbbox(const QRectF &r) const
Definition: element.h:267
virtual bool mousePress(EditData &)
delivers mouseEvent to element in edit mode returns true if mouse event is accepted by element ...
Definition: element.h:381
qreal & ryoffset()
Definition: element.h:250
void setOffset(qreal x, qreal y)
Definition: element.h:247
QPointF delta
Definition: element.h:125
ElementFlag
Definition: element.h:66
bool visible() const
Definition: element.h:210
bool systemFlag() const
Definition: element.h:399
void autoplaceMeasureElement(bool add=true)
Definition: element.h:481
Definition: aeolus.cpp:26
void collectElements(void *data, Element *e)
Definition: element.cpp:1152
Element * e
Definition: element.h:506
virtual const QRectF & bbox() const
Definition: element.h:257
Sid
Definition: style.h:33
bool elementLessThan(const Element *const e1, const Element *const e2)
Definition: element.cpp:1131
Definition: stafftype.h:173
virtual void setOffset(const QPointF &o)
Definition: element.h:246
virtual QVariant getProperty(Pid) const override
Definition: element.cpp:1173
virtual bool isEditable() const
Definition: element.h:293
bool generated() const
Definition: element.h:221
virtual bool sizeIsSpatiumDependent() const override
Definition: element.h:213
bool isNudged() const
Definition: element.h:255
virtual Grip initialEditModeGrip() const
Definition: element.h:312
virtual Element * drop(EditData &)
Handle a dropped element at canvas relative pos of given element type and subtype.
Definition: element.h:375
OffsetChange _offsetChanged
set by user actions that change offset, used by autoplace
Definition: element.h:164
virtual void layout()
Definition: element.h:334
qreal & rxoffset()
Definition: element.h:249
virtual qreal baseLine() const
Definition: element.h:275
void setPos(const QPointF &p)
Definition: element.h:234
bool enabled() const
Definition: element.h:419
QList< Element * > elements
Definition: element.h:531
virtual qreal y() const
Definition: element.h:232
Definition: xmlwriter.h:26
bool shift() const
Definition: element.h:146
QVariant data
Definition: element.h:500
void autoplaceSegmentElement(bool add=true)
Definition: element.h:480
virtual PropertyFlags propertyFlags(Pid) const
Definition: scoreElement.cpp:735
ElementFlags _flags
valid after call to layout()
Definition: element.h:168
QPointF _pos
Reference position, relative to _parent, set by autoplace.
Definition: element.h:162
virtual qreal x() const
Definition: element.h:231
const QPointF & offset() const
Definition: element.h:245
QList< ElementEditData * > data
Definition: element.h:112
Definition: element.h:111
bool selected() const
Definition: element.h:207
void setVoice(int v)
Definition: element.h:325
QPointF _offset
offset from reference position, set by autoplace or user
Definition: element.h:163
virtual Q_INVOKABLE QString _name() const
Definition: element.h:343
QPointF dragOffset
Definition: element.h:136
Definition: xmlreader.h:28
virtual void setColor(const QColor &c)
Definition: element.h:349
qreal _mag
standard magnification (derived value)
Definition: element.h:161
virtual void setAutoplace(bool v)
Definition: element.h:426
void setSystemFlag(bool v) const
Definition: element.h:400
bool isStartEndGrip()
Definition: element.h:147
virtual void setVisible(bool f)
Definition: element.h:211
QVector< QRectF > grip
Definition: element.h:117
bool addToSkyline() const
Definition: element.h:427
virtual void move(const QPointF &s)
Definition: element.h:238
virtual int subtype() const
Definition: element.h:277
Definition: fraction.h:46
virtual Shape shape() const
Definition: element.h:271
void setPos(qreal x, qreal y)
Definition: element.h:233
ElementType
Definition: types.h:34
QPointF startMove
Definition: element.h:122
bool dropTarget() const
Definition: element.h:411
Spatium _minDistance
autoplace min distance
Definition: element.h:166
virtual void draw(QPainter *) const
Definition: element.h:279
QRectF canvasBoundingRect() const
Definition: element.h:265
EditData(MuseScoreView *v)
Definition: element.h:140
Definition: element.h:498
PropertyFlags f
Definition: element.h:501
virtual QRectF & bbox()
Definition: element.h:258
virtual QColor color() const
Definition: element.h:345
QRectF pageBoundingRect() const
Definition: element.h:264
QString s
Definition: element.h:131
bool flag(ElementFlag f) const
Definition: element.h:205
void setFlag(ElementFlag f, bool v) const
Definition: element.h:204
qreal point(const Spatium sp) const
Definition: element.h:394
const QList< Element * > & getElements() const
Definition: element.h:534
void setPlacement(Placement val)
Definition: element.h:217
virtual void setbbox(const QRectF &r) const
Definition: element.h:266
Q_DECLARE_OPERATORS_FOR_FLAGS(ElementFlags)
void setTrailer(bool val)
Definition: element.h:406
virtual QString screenReaderInfo() const
Definition: element.h:466
QPointF & roffset()
Definition: element.h:248
Pid propertyId(const QStringRef &s)
Definition: property.cpp:347
EditBehavior
Definition: element.h:173
void setSelectable(bool val)
Definition: element.h:409
int _z
Definition: element.h:179
uint tag() const
Definition: element.h:422
bool header() const
Definition: element.h:402
void setEnabled(bool val)
Definition: element.h:420
void pushProperty(Pid pid)
Definition: element.h:510
const QPointF & ipos() const
Definition: element.h:229
Definition: mscoreview.h:32