Line data Source code
1 : /*
2 : * SPDX-License-Identifier: GPL-3.0-only
3 : * MuseScore-Studio-CLA-applies
4 : *
5 : * MuseScore Studio
6 : * Music Composition & Notation
7 : *
8 : * Copyright (C) 2021 MuseScore Limited and others
9 : *
10 : * This program is free software: you can redistribute it and/or modify
11 : * it under the terms of the GNU General Public License version 3 as
12 : * published by the Free Software Foundation.
13 : *
14 : * This program is distributed in the hope that it will be useful,
15 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 : * GNU General Public License for more details.
18 : *
19 : * You should have received a copy of the GNU General Public License
20 : * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 : */
22 : #pragma once
23 :
24 : #include "scoreelement.h"
25 :
26 : #include <QQmlListProperty>
27 :
28 : #include "engraving/dom/engravingitem.h"
29 : #include "engraving/dom/arpeggio.h"
30 : #include "engraving/dom/barline.h"
31 : #include "engraving/dom/beam.h"
32 : #include "engraving/dom/bracketitem.h"
33 : #include "engraving/dom/chord.h"
34 : #include "engraving/dom/fret.h"
35 : #include "engraving/dom/harmony.h"
36 : #include "engraving/dom/hook.h"
37 : #include "engraving/dom/lyrics.h"
38 : #include "engraving/dom/measure.h"
39 : #include "engraving/dom/note.h"
40 : #include "engraving/dom/notedot.h"
41 : #include "engraving/dom/ornament.h"
42 : #include "engraving/dom/page.h"
43 : #include "engraving/dom/segment.h"
44 : #include "engraving/dom/spanner.h"
45 : #include "engraving/dom/staff.h"
46 : #include "engraving/dom/stem.h"
47 : #include "engraving/dom/stemslash.h"
48 : #include "engraving/dom/system.h"
49 : #include "engraving/dom/systemdivider.h"
50 : #include "engraving/dom/timesig.h"
51 : #include "engraving/dom/tremolosinglechord.h"
52 : #include "engraving/dom/tremolotwochord.h"
53 : #include "engraving/dom/tuplet.h"
54 : #include "engraving/dom/tie.h"
55 : #include "engraving/dom/accidental.h"
56 :
57 : #include "playevent.h"
58 :
59 : // api
60 : #include "apitypes.h"
61 :
62 : Q_MOC_INCLUDE("engraving/api/v1/part.h")
63 :
64 : namespace mu::engraving::apiv1 {
65 : class Fraction;
66 : class FretDiagram;
67 : class Harmony;
68 : class IntervalWrapper;
69 : class EngravingItem;
70 : class Lyrics;
71 : class Part;
72 : class Spanner;
73 : class Staff;
74 : class System;
75 : class Tie;
76 : class Tuplet;
77 : class Measure;
78 : class Beam;
79 :
80 : //---------------------------------------------------------
81 : // wrap
82 : //---------------------------------------------------------
83 :
84 : extern EngravingItem* wrap(mu::engraving::EngravingItem* se, Ownership own = Ownership::SCORE);
85 :
86 : #define API_PROPERTY(name, pid) \
87 : Q_PROPERTY(QVariant name READ get_##name WRITE set_##name RESET reset_##name) \
88 : QVariant get_##name() const { return get(mu::engraving::Pid::pid); } \
89 : void set_##name(QVariant val) { set(mu::engraving::Pid::pid, val); } \
90 : void reset_##name() { reset(mu::engraving::Pid::pid); }
91 :
92 : /**
93 : * API_PROPERTY flavor which allows to define the property type.
94 : * Can be used if it is known that this property is always valid
95 : * for this type, otherwise this macro won't allow an `undefined`
96 : * value to be exposed to QML in case of invalid property.
97 : */
98 : #define API_PROPERTY_T(type, name, pid) \
99 : Q_PROPERTY(type name READ get_##name WRITE set_##name RESET reset_##name) \
100 : type get_##name() const { return get(mu::engraving::Pid::pid).value<type>(); } \
101 : void set_##name(type val) { set(mu::engraving::Pid::pid, QVariant::fromValue(val)); } \
102 : void reset_##name() { reset(mu::engraving::Pid::pid); }
103 :
104 : #define API_PROPERTY_ENUM(Enum, name, pid) \
105 : Q_PROPERTY(QJSValue name READ get_##name WRITE set_##name RESET reset_##name) \
106 : QJSValue get_##name() const { \
107 : int val = get(mu::engraving::Pid::pid).toInt(); \
108 : if (apiversion() == 1) { \
109 : return QJSValue(val); \
110 : } else { \
111 : static const QMetaEnum meta = QMetaEnum::fromType<Enum>(); \
112 : return QJSValue(QString(meta.valueToKey(val))); \
113 : } \
114 : } \
115 : void set_##name(QJSValue val) { \
116 : if (apiversion() == 1) { \
117 : set(mu::engraving::Pid::pid, QVariant(val.toInt())); \
118 : } else { \
119 : static const QMetaEnum meta = QMetaEnum::fromType<Enum>(); \
120 : std::string key = val.toString().toStdString(); \
121 : set(mu::engraving::Pid::pid, meta.keyToValue(key.c_str())); \
122 : } \
123 : } \
124 : void reset_##name() { reset(mu::engraving::Pid::pid); }
125 :
126 : #define API_PROPERTY_READ_ONLY(name, pid) \
127 : Q_PROPERTY(QVariant name READ get_##name) \
128 : QVariant get_##name() const { return get(mu::engraving::Pid::pid); }
129 :
130 : #define API_PROPERTY_READ_ONLY_T(type, name, pid) \
131 : Q_PROPERTY(type name READ get_##name) \
132 : type get_##name() const { return get(mu::engraving::Pid::pid).value<type>(); } \
133 :
134 : //---------------------------------------------------------
135 : // EngravingItem
136 : // EngravingItem wrapper
137 : //---------------------------------------------------------
138 :
139 : /** APIDOC
140 : * Class representing a engraving item.
141 : * @class EngravingItem
142 : * @extends Engraving.ScoreElement
143 : * @memberof Engraving
144 : * @hideconstructor
145 : */
146 : class EngravingItem : public apiv1::ScoreElement
147 : {
148 : Q_OBJECT
149 :
150 : /** APIDOC
151 : * Parent item for this item.
152 : * @readonly
153 : * @q_property {Engraving.EngravingItem}
154 : */
155 : Q_PROPERTY(apiv1::EngravingItem * parent READ parent)
156 :
157 : /** APIDOC
158 : * Staff which this item belongs to.
159 : * @readonly
160 : * @q_property {Engraving.Staff}
161 : */
162 : Q_PROPERTY(apiv1::Staff * staff READ staff)
163 :
164 : /** APIDOC
165 : * Staff index for this element.
166 : * @readonly
167 : * @q_property {Number}
168 : * @since 4.6
169 : */
170 : Q_PROPERTY(int staffIdx READ staffIdx)
171 :
172 : /** APIDOC
173 : * Effective staff index for this element. Used by system objects,
174 : * as they may not always appear at their staffIdx
175 : * @readonly
176 : * @q_property {Number}
177 : * @since 4.6
178 : */
179 : Q_PROPERTY(int effectiveStaffIdx READ effectiveStaffIdx)
180 :
181 : /** APIDOC
182 : * Staff index for this element, accounting for cross-staffing.
183 : * @readonly
184 : * @q_property {Number}
185 : * @since 4.6
186 : */
187 : Q_PROPERTY(int vStaffIdx READ vStaffIdx)
188 :
189 : /** APIDOC
190 : * X-axis offset from a reference position in spatium units.
191 : * @see {@link Engraving.EngravingItem.offset}
192 : * @q_property {Number}
193 : */
194 : Q_PROPERTY(float offsetX READ offsetX WRITE setOffsetX)
195 :
196 : /** APIDOC
197 : * Y-axis offset from a reference position in spatium units.
198 : * @see {@link Engraving.EngravingItem.offset}
199 : * @q_property {Number}
200 : */
201 : Q_PROPERTY(float offsetY READ offsetY WRITE setOffsetY)
202 :
203 : /** APIDOC
204 : * Reference position of this element relative to its parent element.
205 : *
206 : * This is an offset from the parent object that is determined by the
207 : * autoplace feature. It includes any other offsets applied to the
208 : * element. You can use this value to accurately position other elements
209 : * related to the same parent.
210 : *
211 : * This value is in spatium units for compatibility with EngravingItem.offsetX.
212 : * @readonly
213 : * @q_property {Number}
214 : */
215 : Q_PROPERTY(float posX READ posX)
216 :
217 : /** APIDOC
218 : * Reference position of this element relative to its parent element.
219 : *
220 : * This is an offset from the parent object that is determined by the
221 : * autoplace feature. It includes any other offsets applied to the
222 : * element. You can use this value to accurately position other elements
223 : * related to the same parent.
224 : *
225 : * This value is in spatium units for compatibility with EngravingItem.offsetY.
226 : * @readonly
227 : * @q_property {Number}
228 : */
229 : Q_PROPERTY(float posY READ posY)
230 :
231 : /** APIDOC
232 : * Reference position of this element relative to its parent element, in spatium units.
233 : * Use `pos.x` or `pos.y` to access the X and Y components of this point.
234 : * @see {@link see Engraving.EngravingItem::posX}
235 : * @see {@link see Engraving.EngravingItem::posY}
236 : * @readonly
237 : * @q_property {Point}
238 : * @since 4.6
239 : */
240 : Q_PROPERTY(QPointF pos READ pos)
241 :
242 : /** APIDOC
243 : * Position of this element in page coordinates, in spatium units.
244 : * @readonly
245 : * @q_property {Point}
246 : */
247 : Q_PROPERTY(QPointF pagePos READ pagePos)
248 :
249 : /** APIDOC
250 : * Position of this element relative to the canvas (user interface), in spatium units.
251 : * @readonly
252 : * @q_property {Point}
253 : * @since 4.6
254 : */
255 : Q_PROPERTY(QPointF canvasPos READ canvasPos)
256 :
257 : /** APIDOC
258 : * Bounding box of this element.
259 : *
260 : * This value is in spatium units for compatibility with other EngravingItem positioning properties.
261 : * @readonly
262 : * @q_property {Rect}
263 : */
264 : Q_PROPERTY(QRectF bbox READ bbox)
265 :
266 : /** APIDOC
267 : * Subtype of this element.
268 : * @readonly
269 : * @q_property {Number}
270 : * @since 4.6
271 : */
272 : Q_PROPERTY(int subtype READ subtype)
273 :
274 : /** APIDOC
275 : * If the element points upwards.
276 : * Valid for: Chords, stems, beams, ties, slurs,
277 : * guitar bends, tuplets, tremolos, articulations
278 : * @readonly
279 : * @q_property {Boolean}
280 : * @since 4.6
281 : */
282 : Q_PROPERTY(bool up READ up)
283 :
284 : /** APIDOC
285 : * The header element flag.
286 : * @readonly
287 : * @q_property {Boolean}
288 : * @since 4.6
289 : */
290 : Q_PROPERTY(bool header READ header)
291 :
292 : /** APIDOC
293 : * The trailer element flag.
294 : * @readonly
295 : * @q_property {Boolean}
296 : * @since 4.6
297 : */
298 : Q_PROPERTY(bool trailer READ trailer)
299 :
300 : /** APIDOC
301 : * The isMovable element flag.
302 : * Controls whether this element can be dragged by the mouse.
303 : * @readonly
304 : * @q_property {Boolean}
305 : * @since 4.6
306 : */
307 : Q_PROPERTY(bool isMovable READ isMovable)
308 :
309 : /** APIDOC
310 : * The enabled element flag.
311 : * @readonly
312 : * @q_property {Boolean}
313 : * @since 4.6
314 : */
315 : Q_PROPERTY(bool enabled READ enabled)
316 :
317 : /** APIDOC
318 : * Whether this element is accounted for in layout calculations.
319 : * @readonly
320 : * @q_property {Boolean}
321 : * @since 4.6
322 : */
323 : Q_PROPERTY(bool addToSkyline READ addToSkyline)
324 :
325 : /** APIDOC
326 : * Unlike the name might suggest, this property no longer returns the subtype and is scarcely used.
327 : * Named 'subtype' prior to MuseScore 4.6
328 : * @q_property {Number}
329 : */
330 0 : API_PROPERTY_T(int, subType, SUBTYPE)
331 :
332 : /** APIDOC
333 : * Indicates that the element is selected.
334 : * @readonly
335 : * @q_property {Boolean}
336 : */
337 0 : API_PROPERTY_READ_ONLY_T(bool, selected, SELECTED)
338 :
339 : /** APIDOC
340 : * Indicates that the element is generated.
341 : * @readonly
342 : * @q_property {Boolean}
343 : */
344 0 : API_PROPERTY_READ_ONLY_T(bool, generated, GENERATED)
345 :
346 : /** APIDOC
347 : * Item color
348 : * @see {@link https://doc.qt.io/qt-5/qml-color.html}
349 : * @q_property {Color}
350 : */
351 0 : API_PROPERTY_T(QColor, color, COLOR)
352 :
353 : /** APIDOC
354 : * Indicates that the element is visible.
355 : * @q_property {Boolean}
356 : */
357 0 : API_PROPERTY_T(bool, visible, VISIBLE)
358 :
359 : /** APIDOC
360 : * Stacking order of this element
361 : * @q_property {Number}
362 : */
363 0 : API_PROPERTY_T(int, z, Z)
364 :
365 : /** APIDOC
366 : * Whether this element is cue size.
367 : * @q_property {Boolean}
368 : */
369 0 : API_PROPERTY_T(bool, small, SMALL)
370 :
371 : /** APIDOC
372 : * For staves and parts: Whether to hide systems when they are empty.
373 : * @q_property {Engraving.AutoOnOff}
374 : * @since 4.6
375 : */
376 0 : API_PROPERTY_ENUM(enums::AutoOnOff, hideWhenEmpty, HIDE_WHEN_EMPTY)
377 :
378 : /** APIDOC
379 : * For parts: Whether to only hide staves on a system if the entire instrument is empty.
380 : * @q_property {Boolean}
381 : * @since 4.6
382 : */
383 0 : API_PROPERTY_T(bool, hideStavesWhenIndividuallyEmpty, HIDE_STAVES_WHEN_INDIVIDUALLY_EMPTY)
384 :
385 : /** APIDOC
386 : * For clefs, key signatures, time signatures and system breaks:
387 : * Whether to generate courtesy objects.
388 : * @q_property {Boolean}
389 : */
390 0 : API_PROPERTY_T(bool, showCourtesy, SHOW_COURTESY)
391 :
392 : /** APIDOC
393 : * For key signatures: The key signature mode.
394 : * @q_property {Engraving.KeyMode}
395 : * @since 4.6
396 : */
397 0 : API_PROPERTY_ENUM(enums::KeyMode, keysig_mode, KEYSIG_MODE)
398 :
399 : /** APIDOC
400 : * For slurs & ties: The line style of the slur `tie`.
401 : * @q_property {Engraving.SlurStyleType}
402 : */
403 0 : API_PROPERTY_ENUM(enums::SlurStyleType, lineType, SLUR_STYLE_TYPE)
404 :
405 : /** APIDOC
406 : * Type of note head
407 : * @q_property {Engraving.NoteHeadType}
408 : */
409 0 : API_PROPERTY_ENUM(enums::NoteHeadType, headType, HEAD_TYPE)
410 :
411 : /** APIDOC
412 : * Group of note head
413 : * @q_property {Engraving.NoteHeadGroup}
414 : */
415 0 : API_PROPERTY_ENUM(enums::NoteHeadGroup, headGroup, HEAD_GROUP)
416 :
417 : /** APIDOC
418 : * Articulation anchor
419 : * @q_property {Number}
420 : */
421 0 : API_PROPERTY_T(int, articulationAnchor, ARTICULATION_ANCHOR)
422 :
423 : /** APIDOC
424 : * The direction of this element,
425 : * @q_property {Engraving.Direction}
426 : */
427 0 : API_PROPERTY_ENUM(enums::Direction, direction, DIRECTION)
428 :
429 : /** APIDOC
430 : * For parentheses: The horizontal direction.
431 : * @q_property {Engraving.DirectionH}
432 : * @since 4.6
433 : */
434 0 : API_PROPERTY_ENUM(enums::DirectionH, horizontalDirection, HORIZONTAL_DIRECTION)
435 :
436 : /** APIDOC
437 : * For chords, stems, beams and two-chord tremolos: The stem direction.
438 : * @q_property {Engraving.Direction}
439 : */
440 0 : API_PROPERTY_ENUM(enums::Direction, stemDirection, STEM_DIRECTION)
441 :
442 : /** APIDOC
443 : * For chords, stems, beams and two-chord tremolos: The slur direction.
444 : * @q_property {Engraving.Direction}
445 : */
446 0 : API_PROPERTY_ENUM(enums::Direction, slurDirection, SLUR_DIRECTION)
447 :
448 : /// For notes: The horizontal direction of the notehead.
449 : /// One of PluginAPI::PluginAPI::DirectionH values.
450 : ///\since MuseScore 4.6
451 0 : API_PROPERTY(mirrorHead, MIRROR_HEAD)
452 : ///\since MuseScore 4.6
453 0 : API_PROPERTY(hasParentheses, HAS_PARENTHESES)
454 : /// For breath marks and section breaks: The amount to
455 : /// pause playback by, in seconds.
456 0 : API_PROPERTY_T(qreal, pause, PAUSE)
457 :
458 : /// For barlines: The barline type.
459 0 : API_PROPERTY(barlineType, BARLINE_TYPE)
460 : /// For barlines: Whether the barline spans to the next stave.
461 0 : API_PROPERTY(barlineSpan, BARLINE_SPAN)
462 : /// For barlines: The offset of the start of this barline from the
463 : /// default position. Measured in steps equivalent to half a spatium.
464 0 : API_PROPERTY_T(int, barlineSpanFrom, BARLINE_SPAN_FROM)
465 : /// For barlines: The offset of the end of this barline from the
466 : /// default position. Measured in steps equivalent to half a spatium.
467 0 : API_PROPERTY_T(int, barlineSpanTo, BARLINE_SPAN_TO)
468 : /// For repeat barlines: Whether they display winged tips.
469 : /// \note this property controls the global style setting \p repeatBarTips
470 : ///\since MuseScore 4.6
471 0 : API_PROPERTY_T(bool, barlineShowTips, BARLINE_SHOW_TIPS)
472 :
473 : /// Offset from a reference position in spatium units.
474 : /// Use `Qt.point(x, y)` to create a point value which can be
475 : /// assigned to this property.
476 : /// \see EngravingItem::offsetX
477 : /// \see EngravingItem::offsetY
478 0 : API_PROPERTY_T(QPointF, offset, OFFSET)
479 0 : API_PROPERTY_T(bool, ghost, GHOST)
480 0 : API_PROPERTY_T(bool, play, PLAY)
481 :
482 : /// For vertical frames and text frames: Their height.
483 0 : API_PROPERTY(boxHeight, BOX_HEIGHT)
484 : /// For horizontal frames: Its width.
485 0 : API_PROPERTY(boxWidth, BOX_WIDTH)
486 : /// Whether frames should autosize themselves to their
487 : /// contents, rather than use their set height / width.
488 : ///\since MuseScore 4.6
489 0 : API_PROPERTY_T(bool, boxAutoSize, BOX_AUTOSIZE)
490 :
491 : /// The top padding for a given frame. Affects the
492 : /// positioning of its contents.
493 0 : API_PROPERTY(topGap, TOP_GAP)
494 : /// The bottom padding for a given frame.
495 0 : API_PROPERTY(bottomGap, BOTTOM_GAP)
496 : /// The left padding for a given frame.
497 0 : API_PROPERTY_T(qreal, leftMargin, LEFT_MARGIN)
498 : /// The right padding for a given frame.
499 0 : API_PROPERTY_T(qreal, rightMargin, RIGHT_MARGIN)
500 : /// The top gap for a given frame. Affects the positioning
501 : /// of the frame relative to surrounding elements.
502 0 : API_PROPERTY_T(qreal, topMargin, TOP_MARGIN)
503 : /// The bottom gap for a given frame.
504 0 : API_PROPERTY_T(qreal, bottomMargin, BOTTOM_MARGIN)
505 : /// For vertical-type frames: The clearance for notation above the frame.
506 : /// \since MuseScore 4.6
507 0 : API_PROPERTY(paddingToNotationAbove, PADDING_TO_NOTATION_ABOVE)
508 : /// For vertical-type frames: The clearance for notation below the frame.
509 : /// \since MuseScore 4.6
510 0 : API_PROPERTY(paddingToNotationBelow, PADDING_TO_NOTATION_BELOW)
511 : /// For layout breaks: The layout break type.
512 : /// One of PluginAPI::PluginAPI::LayoutBreakType values
513 0 : API_PROPERTY(layoutBreakType, LAYOUT_BREAK)
514 : /// For images attached to frames: Whether they
515 : /// scale themselves to the frame's size.
516 0 : API_PROPERTY_T(bool, autoscale, AUTOSCALE)
517 : /// For images: The size of an image.
518 0 : API_PROPERTY(size, SIZE)
519 :
520 : ///\since MuseScore 4.6
521 0 : API_PROPERTY_T(qreal, imageHeight, IMAGE_HEIGHT)
522 : ///\since MuseScore 4.6
523 0 : API_PROPERTY_T(qreal, imageWidth, IMAGE_WIDTH)
524 : /// For images: Whether this image is part of a frame.
525 : ///\since MuseScore 4.6
526 0 : API_PROPERTY_T(bool, imageFramed, IMAGE_FRAMED)
527 :
528 : /// For fretboard diagram legends: The text (chord symbols) scale.
529 0 : API_PROPERTY_T(qreal, fretFrameTextScale, FRET_FRAME_TEXT_SCALE)
530 : /// For fretboard diagram legends: The fretboard diagram scale.
531 0 : API_PROPERTY_T(qreal, fretFrameDiagramScale, FRET_FRAME_DIAGRAM_SCALE)
532 : /// For fretboard diagram legends: The gap between columns, in spatiums.
533 0 : API_PROPERTY(fretFrameColumnGap, FRET_FRAME_COLUMN_GAP)
534 : /// For fretboard diagram legends: The gap between rows, in spatiums.
535 0 : API_PROPERTY(fretFrameRowGap, FRET_FRAME_ROW_GAP)
536 : /// For fretboard diagram legends: The number of chords per row.
537 0 : API_PROPERTY_T(int, fretFrameChordPerRow, FRET_FRAME_CHORDS_PER_ROW)
538 : /// For fretboard diagram legends: The horizontal alignment of its contents.
539 0 : API_PROPERTY_T(int, fretFrameHAlign, FRET_FRAME_H_ALIGN)
540 : /// For fretboard diagram legends: The order the diagrams are displayed in
541 0 : API_PROPERTY(fretFrameDiagramsOrder, FRET_FRAME_DIAGRAMS_ORDER)
542 :
543 : /// For time signatures: Their scale.
544 0 : API_PROPERTY(scale, SCALE)
545 : /// For images: Whether the aspect ratio is locked.
546 0 : API_PROPERTY_T(bool, lockAspectRatio, LOCK_ASPECT_RATIO)
547 : /// For images: Whether their size is measured in spatiums.
548 0 : API_PROPERTY_T(bool, sizeIsSpatium, SIZE_IS_SPATIUM)
549 : /// For text based elements.
550 0 : API_PROPERTY(text, TEXT)
551 : ///\since MuseScore 4.6
552 0 : API_PROPERTY(htmlText, HTML_TEXT)
553 : /// For beams and two-chord tremolos: Whether their
554 : /// position has been modified by the user.
555 : ///\since MuseScore 4.6
556 0 : API_PROPERTY_T(bool, userModified, USER_MODIFIED)
557 : /// For beams and two-chord tremolos: Their position.
558 0 : API_PROPERTY(beamPos, BEAM_POS)
559 : /// For beams and two-chord tremolos: Whether they are forcibly horizontal.
560 0 : API_PROPERTY_T(bool, beamNoSlope, BEAM_NO_SLOPE)
561 : /// For cross-staff beams: Their positioning relative to the staves.
562 : ///\since MuseScore 4.6
563 0 : API_PROPERTY_T(int, crossStaffMove, BEAM_CROSS_STAFF_MOVE)
564 : /// For stems: The user-added length offset.
565 0 : API_PROPERTY(userLen, USER_LEN)
566 :
567 : /// For spacers: amount of space between staves.
568 0 : API_PROPERTY(space, SPACE)
569 : /// For tempo text: The tempo
570 0 : API_PROPERTY(tempo, TEMPO)
571 : /// For tempo text: Whether the tempo follows the written value.
572 0 : API_PROPERTY_T(bool, tempoFollowText, TEMPO_FOLLOW_TEXT)
573 : /// For tempo text: Whether the tempo is aligned right of rehearsal marks.
574 : ///\since MuseScore 4.6
575 0 : API_PROPERTY_T(bool, tempoAlignRightOfRehearsalMark, TEMPO_ALIGN_RIGHT_OF_REHEARSAL_MARK)
576 : /// For accidentals: Controls what type of brackets to show.
577 : /// One of PluginAPI::PluginAPI::AccidentalBracket values
578 0 : API_PROPERTY_T(int, accidentalBracket, ACCIDENTAL_BRACKET)
579 : /// For accidentals: Controls the type of accidental.
580 : /// One of PluginAPI::PluginAPI::AccidentalType values
581 : ///\since MuseScore 4.6
582 0 : API_PROPERTY_T(int, accidentalType, ACCIDENTAL_TYPE)
583 : /// For accidentals: The vertical order relative to other accidentals.
584 : ///\since MuseScore 4.6
585 0 : API_PROPERTY_T(int, stackingOrderOffset, ACCIDENTAL_STACKING_ORDER_OFFSET)
586 : /// For time signatures: Custom numerator text to override the default.
587 0 : API_PROPERTY(numeratorString, NUMERATOR_STRING)
588 : /// For time signatures: Custom denominator text to override the default.
589 0 : API_PROPERTY(denominatorString, DENOMINATOR_STRING)
590 0 : API_PROPERTY_T(int, fbprefix, FBPREFIX)
591 0 : API_PROPERTY_T(int, fbdigit, FBDIGIT)
592 0 : API_PROPERTY_T(int, fbsuffix, FBSUFFIX)
593 0 : API_PROPERTY_T(int, fbcontinuationline, FBCONTINUATIONLINE)
594 :
595 : ///\since MuseScore 4.6
596 0 : API_PROPERTY_T(int, fbparenthesis1, FBPARENTHESIS1)
597 : ///\since MuseScore 4.6
598 0 : API_PROPERTY_T(int, fbparenthesis2, FBPARENTHESIS2)
599 : ///\since MuseScore 4.6
600 0 : API_PROPERTY_T(int, fbparenthesis3, FBPARENTHESIS3)
601 : ///\since MuseScore 4.6
602 0 : API_PROPERTY_T(int, fbparenthesis4, FBPARENTHESIS4)
603 : ///\since MuseScore 4.6
604 0 : API_PROPERTY_T(int, fbparenthesis5, FBPARENTHESIS5)
605 :
606 : /// For ottavas: Their type, one of PluginAPI::PluginAPI::OttavaType values.
607 0 : API_PROPERTY_T(int, ottavaType, OTTAVA_TYPE)
608 : /// For ottavas: Whether they display numbers or numbers and text.
609 0 : API_PROPERTY_T(bool, numbersOnly, NUMBERS_ONLY)
610 : /// For trills: Their type, one of PluginAPI::PluginAPI::TrillType.
611 0 : API_PROPERTY_T(int, trillType, TRILL_TYPE)
612 : /// For vibratos: Their type, one of PluginAPI::PluginAPI::VibratoType.
613 0 : API_PROPERTY_T(int, vibratoType, VIBRATO_TYPE)
614 : /// For hairpins: Whether their tip is circled.
615 0 : API_PROPERTY_T(bool, hairpinCircledTip, HAIRPIN_CIRCLEDTIP)
616 :
617 : /// For hairpins: Their type, one of PluginAPI::PluginAPI::HairpinType values.
618 0 : API_PROPERTY_T(int, hairpinType, HAIRPIN_TYPE)
619 : /// For hairpins: The height of the hairpin.
620 0 : API_PROPERTY(hairpinHeight, HAIRPIN_HEIGHT)
621 : /// For hairpins: The height of the hairpin when continuing onto a new system.
622 0 : API_PROPERTY(hairpinContHeight, HAIRPIN_CONT_HEIGHT)
623 : /// For hairpins: The velocity change.
624 0 : API_PROPERTY_T(int, veloChange, VELO_CHANGE)
625 : /// The way a hairpin interpolates between values.
626 : /// one of PluginAPI::PluginAPI::ChangeMethod values
627 0 : API_PROPERTY(veloChangeMethod, VELO_CHANGE_METHOD)
628 : /// For dynamics such as fp: How fast to change dynamics.
629 0 : API_PROPERTY(veloChangeSpeed, VELO_CHANGE_SPEED)
630 : /// For dynamics: Their type, one of PluginAPI::PluginAPI::DynamicType values.
631 : ///\since MuseScore 4.6
632 0 : API_PROPERTY(dynamicType, DYNAMIC_TYPE)
633 :
634 : /// For hairpins: Whether to use single note dynamics
635 : /// (not change dynamic during individual notes).
636 : ///\since MuseScore 4.6
637 0 : API_PROPERTY_T(bool, singleNoteDynamics, SINGLE_NOTE_DYNAMICS)
638 : /// The way a ramp interpolates between values.
639 : /// \since MuseScore 3.5
640 0 : API_PROPERTY(changeMethod, CHANGE_METHOD)
641 : /// For text-based elements: The text placement,
642 : /// one of PluginAPI::PluginAPI::Placement values.
643 0 : API_PROPERTY(placement, PLACEMENT)
644 : /// For multimeasure rest ranges and measure numbers:
645 : /// The horizontal placement, one of PluginAPI::PluginAPI::PlacementH values.
646 : ///\since MuseScore 4.6
647 0 : API_PROPERTY(hPlacement, HPLACEMENT)
648 : /// For multimeasure rest ranges: The bracket type,
649 : /// one of PluginAPI::PluginAPI::MMRestRangeBracketType values.
650 0 : API_PROPERTY_T(int, mmRestRangeBracketType, MMREST_RANGE_BRACKET_TYPE)
651 : /// For dynamics: Their velocity
652 0 : API_PROPERTY_T(int, velocity, VELOCITY)
653 : /// For jumps: Which marker to jump to.
654 0 : API_PROPERTY(jumpTo, JUMP_TO)
655 : /// For jumps: Which marker to play until.
656 0 : API_PROPERTY(playUntil, PLAY_UNTIL)
657 : /// For jumps: Which marker to continue at.
658 0 : API_PROPERTY(continueAt, CONTINUE_AT)
659 : /// For markers: Their label, used by jumps.
660 0 : API_PROPERTY(label, LABEL)
661 : /// For markers: The marker type,
662 : /// one of PluginAPI::PluginAPI::MarkerType values.
663 0 : API_PROPERTY_T(int, markerType, MARKER_TYPE)
664 : /// The size of musical symbols used.
665 : /// \since MuseScore 4.6
666 0 : API_PROPERTY_T(qreal, musicSymbolSize, MUSIC_SYMBOL_SIZE)
667 : /// For markers: Whether the symbol is aligned with the barline.
668 : /// \since MuseScore 4.6
669 0 : API_PROPERTY_T(bool, markerCenterOnSymbol, MARKER_CENTER_ON_SYMBOL)
670 : /// For arpeggios: The position of the top handle.
671 0 : API_PROPERTY_T(qreal, arpUserLen1, ARP_USER_LEN1)
672 : /// For arpeggios: The position of the bottom handle.
673 0 : API_PROPERTY_T(qreal, arpUserLen2, ARP_USER_LEN2)
674 :
675 : /// For glissandos: Their type,
676 : /// one of PluginAPI::PluginAPI::GlissandoType values.
677 0 : API_PROPERTY_T(int, glissType, GLISS_TYPE)
678 : /// For glissandos: The text they display.
679 0 : API_PROPERTY(glissText, GLISS_TEXT)
680 : /// For glissandos: Whether they display text.
681 0 : API_PROPERTY_T(bool, glissShowText, GLISS_SHOW_TEXT)
682 : /// For glissandos: The play style,
683 : /// one of PluginAPI::PluginAPI::GlissandoStyle values.
684 0 : API_PROPERTY(glissandoStyle, GLISS_STYLE)
685 : /// For glissandos: The amount to ease in by on playback.
686 0 : API_PROPERTY_T(int, glissEaseIn, GLISS_EASEIN)
687 : /// For glissandos: The amount to ease out by on playback.
688 0 : API_PROPERTY_T(int, glissEaseOut, GLISS_EASEOUT)
689 : /// For lines: Whether they can be diagonal,
690 : /// as opposed to locked horizontal.
691 0 : API_PROPERTY_T(bool, diagonal, DIAGONAL)
692 : /// For time signatures: Their rhythmic groups.
693 0 : API_PROPERTY(groups, GROUP_NODES)
694 : /// For lines: Their line style,
695 : /// one of PluginAPI::PluginAPI::LineType values.
696 0 : API_PROPERTY(lineStyle, LINE_STYLE)
697 : /// For lines: The color of the line.
698 0 : API_PROPERTY(lineColor, COLOR)
699 : /// For lines: The width of the line.
700 0 : API_PROPERTY(lineWidth, LINE_WIDTH)
701 : /// For fermatas and arpeggios: How much to stretch
702 : /// their playback by.
703 0 : API_PROPERTY_T(qreal, timeStretch, TIME_STRETCH)
704 : ///For trills and articulation: The ornament style,
705 : /// one of PluginAPI::PluginAPI::OrnamentStyle values
706 0 : API_PROPERTY(ornamentStyle, ORNAMENT_STYLE)
707 : /// For ornaments: Their interval above. To check if
708 : /// this ornament actually has an interval above,
709 : /// use ornament.hasIntervalAbove
710 : ///\since MuseScore 4.6
711 0 : API_PROPERTY(intervalAbove, INTERVAL_ABOVE)
712 : /// For ornaments: Their interval below. To check if
713 : /// this ornament actually has an interval above,
714 : /// use ornament.hasIntervalBelow
715 : ///\since MuseScore 4.6
716 0 : API_PROPERTY(intervalBelow, INTERVAL_BELOW)
717 : /// For ornaments: Controls whether this ornament shows an accidental,
718 : /// one of PluginAPI::PluginAPI::OrnamentShowAccidental values.
719 : ///\since MuseScore 4.6
720 0 : API_PROPERTY_T(int, ornamentShowAccidental, ORNAMENT_SHOW_ACCIDENTAL)
721 : /// For ornaments: Controls whether this ornament shows a cue note,
722 : /// one of PluginAPI::PluginAPI::AutoOnOff values.
723 : ///\since MuseScore 4.6
724 0 : API_PROPERTY(ornamentShowCueNote, ORNAMENT_SHOW_CUE_NOTE)
725 : /// Whether this ornament starts on the upper note.
726 : ///\since MuseScore 4.6
727 0 : API_PROPERTY_T(bool, startOnUpperNote, START_ON_UPPER_NOTE)
728 :
729 : /// For time signatures: The time signature as a fraction.
730 0 : API_PROPERTY(timesig, TIMESIG)
731 : /// For local time signatures: The ratio between the
732 : /// local time signature and the global time signature.
733 0 : API_PROPERTY(timesigStretch, TIMESIG_STRETCH)
734 : /// For time signatures: The time signature type,
735 : /// one of PluginAPI::PluginAPI::TimeSigType values.
736 0 : API_PROPERTY_T(int, timesigType, TIMESIG_TYPE)
737 : /// For multimeasure rests: The vertical position of the number,
738 : /// i.e. the style position plus mmRestNumberOffset.
739 : ///\since MuseScore 4.6
740 : Q_PROPERTY(QVariant mmRestNumberPos READ mmRestNumberPos WRITE setMmRestNumberPos RESET resetMmRestNumberPos)
741 : /// For multimeasure rests: The offset of the number.
742 : ///\since MuseScore 4.6
743 0 : API_PROPERTY(mmRestNumberOffset, MMREST_NUMBER_OFFSET)
744 : /// For multimeasure rests: Whether the number is visible
745 : ///\since MuseScore 4.6
746 0 : API_PROPERTY_T(bool, mmRestNumberVisible, MMREST_NUMBER_VISIBLE)
747 :
748 : /// For measure repeats: The vertical position of the number,
749 : /// i.e. the style position plus measureRepeatNumberOffset.
750 : ///\since MuseScore 4.6
751 : Q_PROPERTY(QVariant measureRepeatNumberPos READ measureRepeatNumberPos WRITE setMeasureRepeatNumberPos RESET resetMeasureRepeatNumberPos)
752 : /// For measure repeats: The offset of the number.
753 : ///\since MuseScore 5.0
754 0 : API_PROPERTY(measureRepeatNumberOffset, MEASURE_REPEAT_NUMBER_OFFSET)
755 :
756 : /// For lyrics and lyrics lines: The verse they are assigned to.
757 0 : API_PROPERTY_T(int, verse, VERSE)
758 :
759 : /// For voltas: The list of passes on which to play the underlying measures.
760 0 : API_PROPERTY(volta_ending, VOLTA_ENDING)
761 : /// For line elements: Controls the visibility of the line.
762 0 : API_PROPERTY_T(bool, lineVisible, LINE_VISIBLE)
763 : /// Controls the scale of various elements.
764 0 : API_PROPERTY_T(qreal, mag, MAG)
765 : /// For parts: Whether this part uses a drumset.
766 0 : API_PROPERTY_T(int, useDrumset, USE_DRUMSET)
767 : /// For accidentals: Whether this accidental was added by
768 : /// the user or generated by the score layout, one of
769 : /// PluginAPI::PluginAPI::AccidentalRole values
770 0 : API_PROPERTY(role, ACCIDENTAL_ROLE)
771 : /// The track of a given element.
772 0 : API_PROPERTY_T(int, track, TRACK) // does conversion work from P_TYPE::SIZE_T ?
773 :
774 : /// For fretboard diagrams: The number of strings to display.
775 0 : API_PROPERTY_T(int, fretStrings, FRET_STRINGS)
776 : /// For fretboard diagrams: The number of frets to display.
777 0 : API_PROPERTY_T(int, fretFrets, FRET_FRETS)
778 : /// For fretboard diagrams: Whether to show the nut.
779 : ///\since MuseScore 4.6
780 0 : API_PROPERTY_T(bool, showNut, FRET_NUT)
781 : /// For fretboard diagrams: The fret number to start the diagram from.
782 4 : API_PROPERTY_T(int, fretOffset, FRET_OFFSET)
783 : /// For fretboard diagrams: The position of the fret number.
784 0 : API_PROPERTY_T(int, fretNumPos, FRET_NUM_POS)
785 : /// For fretboard diagrams: The orientation, one of
786 : /// PluginAPI::PluginAPI::Orientation values
787 : ///\since MuseScore 4.6
788 0 : API_PROPERTY(orientation, ORIENTATION)
789 : /// For fretboard diagrams: Whether fingerings are displayed.
790 : ///\since MuseScore 4.6
791 0 : API_PROPERTY_T(bool, fretShowFingering, FRET_SHOW_FINGERINGS)
792 : /// For fretboard diagrams: The fingering data.
793 : ///\since MuseScore 4.6
794 0 : API_PROPERTY(fretFingering, FRET_FINGERING)
795 :
796 : /// Whether this chord symbol is voiced literally.
797 : ///\since MuseScore 4.6
798 0 : API_PROPERTY_T(bool, harmonyVoiceLiteral, HARMONY_VOICE_LITERAL)
799 : /// The voicing for this chord symbol, one of
800 : /// PluginAPI::PluginAPI::HarmonyVoicing values.
801 : ///\since MuseScore 4.6
802 0 : API_PROPERTY(harmonyVoicing, HARMONY_VOICING)
803 : /// The duration to play this chord symbol for, one of
804 : /// PluginAPI::PluginAPI::HDuration values.
805 : ///\since MuseScore 4.6
806 0 : API_PROPERTY(harmonyDuration, HARMONY_DURATION)
807 : /// The scale of the bass component of a chord symbol.
808 : ///\since MuseScore 4.6
809 0 : API_PROPERTY(harmonyBassScale, HARMONY_BASS_SCALE)
810 : /// Whether to stack modifiers in chord symbols.
811 : ///\since MuseScore 4.6
812 0 : API_PROPERTY_T(bool, harmonyDoNotStackModifiers, HARMONY_DO_NOT_STACK_MODIFIERS)
813 :
814 : /// For brackets: The bracket type, one of
815 : /// PluginAPI::PluginAPI::BracketType values.
816 0 : API_PROPERTY_T(int, systemBracket, SYSTEM_BRACKET)
817 : /// For rests in voice 2+: Controls whether they are
818 : /// displayed in the score.
819 0 : API_PROPERTY_T(bool, gap, GAP)
820 : /// Whether this element participates in autoplacement
821 0 : API_PROPERTY_T(bool, autoplace, AUTOPLACE)
822 : /// For lines: The length of the dashes for dashed lines,
823 : /// in multiples of the line width.
824 0 : API_PROPERTY_T(qreal, dashLineLen, DASH_LINE_LEN)
825 : /// For lines: The length of the gaps between dashes
826 : /// for dashed lines, in multiples of the line width.
827 0 : API_PROPERTY_T(qreal, dashGapLen, DASH_GAP_LEN)
828 : // API_PROPERTY_READ_ONLY( tick, TICK ) // wasn't available in 2.X, disabled due to fractions transition
829 : /// Symbol ID of this element (if appropriate),
830 : /// one of PluginAPI::PluginAPI::SymId values.
831 : /// Valid for symbols, articulation, fermatas and breaths.
832 0 : API_PROPERTY(symbol, SYMBOL)
833 : /// For jumps: Whether to play repeats.
834 0 : API_PROPERTY_T(bool, playRepeats, PLAY_REPEATS)
835 : /// For horizontal frames: Whether to generate brackets,
836 : /// clefs, and key signatures in the next measure.
837 0 : API_PROPERTY_T(bool, createSystemHeader, CREATE_SYSTEM_HEADER)
838 : /// For stafftype changes: The new number of lines for the staff.
839 0 : API_PROPERTY_T(int, staffLines, STAFF_LINES)
840 : /// For stafftype changes: The new distance between lines of the staff.
841 0 : API_PROPERTY(lineDistance, LINE_DISTANCE)
842 : /// For stafftype changes: The new offset for staff contents, in half spaces.
843 0 : API_PROPERTY_T(int, stepOffset, STEP_OFFSET)
844 : /// For stafftype changes: Whether the staff displays barlines.
845 0 : API_PROPERTY_T(bool, staffShowBarlines, STAFF_SHOW_BARLINES)
846 : /// For stafftype changes: Whether the staff displays ledger lines.
847 0 : API_PROPERTY_T(bool, staffShowLedgerlines, STAFF_SHOW_LEDGERLINES)
848 : /// For stafftype changes: Whether notes on the staff are stemless.
849 0 : API_PROPERTY_T(bool, staffStemless, STAFF_STEMLESS)
850 : /// For staves and stafftype changes: Whether the staff lines are invisible.
851 : ///\since MuseScore 4.6
852 0 : API_PROPERTY_T(bool, staffInvisible, STAFF_INVISIBLE)
853 : /// For staves and stafftype changes: The color of the staff lines.
854 : ///\since MuseScore 4.6
855 0 : API_PROPERTY_T(QColor, staffColor, STAFF_COLOR)
856 :
857 : /// Notehead scheme, one of PluginAPI::PluginAPI::NoteHeadScheme values.
858 : /// \since MuseScore 3.5
859 0 : API_PROPERTY(headScheme, HEAD_SCHEME)
860 : /// For stafftype changes: Whether the staff displays clefs.
861 0 : API_PROPERTY_T(bool, staffGenClef, STAFF_GEN_CLEF)
862 : /// For stafftype changes: Whether the staff displays time signatures.
863 0 : API_PROPERTY_T(bool, staffGenTimesig, STAFF_GEN_TIMESIG)
864 : /// For stafftype changes: Whether the staff displays key signatures.
865 0 : API_PROPERTY_T(bool, staffGenKeysig, STAFF_GEN_KEYSIG)
866 : /// For stafftype changes: The vertical offset relative to the previous stafftype.
867 0 : API_PROPERTY(staffYoffset, STAFF_YOFFSET)
868 : /// For bracket items: The number of staves they span.
869 0 : API_PROPERTY_T(int, bracketSpan, BRACKET_SPAN)
870 :
871 : /// For bracket items: The column they occupy.
872 0 : API_PROPERTY_T(int, bracketColumn, BRACKET_COLUMN)
873 : /// For instrument names: Their layout position.
874 0 : API_PROPERTY_T(int, inameLayoutPosition, INAME_LAYOUT_POSITION)
875 : /// For text-based elements: The text style they use.
876 : /// One of PluginAPI::PluginAPI::Tid values
877 0 : API_PROPERTY(subStyle, TEXT_STYLE)
878 : /// For text-based elements: The font face they use.
879 0 : API_PROPERTY(fontFace, FONT_FACE)
880 : /// For text-based elements: The font size they use.
881 0 : API_PROPERTY_T(qreal, fontSize, FONT_SIZE)
882 : /// For text-based elements: The font style they use.
883 0 : API_PROPERTY_T(int, fontStyle, FONT_STYLE)
884 : /// For text-based elements: The line spacing they use.
885 : ///\since MuseScore 4.6
886 0 : API_PROPERTY_T(qreal, lineSpacing, TEXT_LINE_SPACING)
887 :
888 : /// For text-based elements: Their border type,
889 : /// one of PluginAPI::PluginAPI::FrameType values.
890 0 : API_PROPERTY_T(int, frameType, FRAME_TYPE)
891 : /// For text-based elements: The width of their border.
892 0 : API_PROPERTY(frameWidth, FRAME_WIDTH)
893 : /// For text-based elements: The padding of their border.
894 0 : API_PROPERTY(framePadding, FRAME_PADDING)
895 : /// For text-based elements: The radius of their border.
896 0 : API_PROPERTY_T(int, frameRound, FRAME_ROUND)
897 : /// For text-based elements: The outline color of their border.
898 0 : API_PROPERTY_T(QColor, frameFgColor, FRAME_FG_COLOR)
899 : /// For text-based elements: The fill color of their border.
900 0 : API_PROPERTY_T(QColor, frameBgColor, FRAME_BG_COLOR)
901 : /// Whether an element is sized relative to its spatium size.
902 0 : API_PROPERTY_T(bool, sizeSpatiumDependent, SIZE_SPATIUM_DEPENDENT)
903 : /// For text lines: Whether their text is sized relative to its spatium size.
904 : ///\since MuseScore 4.6
905 0 : API_PROPERTY_T(bool, textSizeSpatiumDependent, TEXT_SIZE_SPATIUM_DEPENDENT)
906 : /// The scale of musical symbols in text.
907 : ///\since MuseScore 4.6
908 0 : API_PROPERTY_T(qreal, musicalSymbolsScale, MUSICAL_SYMBOLS_SCALE)
909 : /// For text-based elements: Their text alignment.
910 0 : API_PROPERTY(align, ALIGN)
911 : /// For text-based elements: Their text's vertical alignment,
912 : /// used in sub- or superscript.
913 : ///\since MuseScore 4.6
914 0 : API_PROPERTY_T(int, textScriptAlign, TEXT_SCRIPT_ALIGN)
915 : /// Whether this element is displayed above the system
916 : /// rather than the staff.
917 0 : API_PROPERTY_T(bool, systemFlag, SYSTEM_FLAG)
918 :
919 : /// For text-line-based elements, the text to begin the line.
920 0 : API_PROPERTY(beginText, BEGIN_TEXT)
921 : /// For text-line-based elements, the alignment of the beginning text.
922 0 : API_PROPERTY(beginTextAlign, BEGIN_TEXT_ALIGN)
923 : /// For text-line-based elements, the position of the beginning text.
924 0 : API_PROPERTY(beginTextPosition, BEGIN_TEXT_POSITION)
925 : /// For text-line-based elements, the placement of the beginning text,
926 : /// one of PluginAPI::PluginAPI::TextPlacement values.
927 0 : API_PROPERTY(beginTextPlace, BEGIN_TEXT_PLACE)
928 : /// For text-line-based elements, the hook type at their beginning,
929 : /// one of PluginAPI::PluginAPI::HookType values.
930 0 : API_PROPERTY(beginHookType, BEGIN_HOOK_TYPE)
931 : /// For text-line-based elements, the height of the hook at their beginning.
932 0 : API_PROPERTY(beginHookHeight, BEGIN_HOOK_HEIGHT)
933 : /// For text-line-based elements, the height of the line arrow at their beginning.
934 0 : API_PROPERTY(beginLineArrowHeight, BEGIN_LINE_ARROW_HEIGHT)
935 : /// For text-line-based elements, the height of the line arrow at their beginning.
936 0 : API_PROPERTY(beginLineArrowWidth, BEGIN_LINE_ARROW_WIDTH)
937 : /// For text-line-based elements, the height of the line arrow at their beginning.
938 0 : API_PROPERTY(beginFilledArrowHeight, BEGIN_FILLED_ARROW_HEIGHT)
939 : /// For text-filled-based elements, the height of the filled arrow at their beginning.
940 0 : API_PROPERTY(beginFilledArrowWidth, BEGIN_FILLED_ARROW_WIDTH)
941 : /// For text-line-based elements, the font face of the beginning text.
942 0 : API_PROPERTY(beginFontFace, BEGIN_FONT_FACE)
943 : /// For text-line-based elements, the font size of the beginning text.
944 0 : API_PROPERTY_T(qreal, beginFontSize, BEGIN_FONT_SIZE)
945 : /// For text-line-based elements, the font style of the beginning text.
946 0 : API_PROPERTY_T(int, beginFontStyle, BEGIN_FONT_STYLE)
947 : /// For text-line-based elements, the offset face of the beginning text.
948 0 : API_PROPERTY_T(QPointF, beginTextOffset, BEGIN_TEXT_OFFSET)
949 : /// For text-line-based elements, the distance between the line and text components.
950 : ///\since MuseScore 4.6
951 0 : API_PROPERTY(gapBetweenTextAndLine, GAP_BETWEEN_TEXT_AND_LINE)
952 :
953 : /// For text-line-based elements, the text on new systems.
954 0 : API_PROPERTY(continueText, CONTINUE_TEXT)
955 : /// For text-line-based elements, the alignment of the continuation text.
956 0 : API_PROPERTY(continueTextAlign, CONTINUE_TEXT_ALIGN)
957 : /// For text-line-based elements, the position of the continuation text.
958 0 : API_PROPERTY(continueTextPosition, CONTINUE_TEXT_POSITION)
959 : /// For text-line-based elements, the placement of the continuation text,
960 : /// one of PluginAPI::PluginAPI::TextPlacement values.
961 0 : API_PROPERTY(continueTextPlace, CONTINUE_TEXT_PLACE)
962 : /// For text-line-based elements, the font face of the continuation text.
963 0 : API_PROPERTY(continueFontFace, CONTINUE_FONT_FACE)
964 : /// For text-line-based elements, the font size of the continuation text.
965 0 : API_PROPERTY_T(qreal, continueFontSize, CONTINUE_FONT_SIZE)
966 : /// For text-line-based elements, the font style of the continuation text.
967 0 : API_PROPERTY_T(int, continueFontStyle, CONTINUE_FONT_STYLE)
968 : /// For text-line-based elements, the offset face of the continuation text.
969 0 : API_PROPERTY_T(QPointF, continueTextOffset, CONTINUE_TEXT_OFFSET)
970 :
971 : /// For text-line-based elements, the text at the end of the line.
972 0 : API_PROPERTY(endText, END_TEXT)
973 : /// For text-line-based elements, the alignment of the ending text.
974 0 : API_PROPERTY(endTextAlign, END_TEXT_ALIGN)
975 : /// For text-line-based elements, the position of the ending text.
976 0 : API_PROPERTY(endTextPosition, END_TEXT_POSITION)
977 : /// For text-line-based elements, the placement of the ending text,
978 : /// one of PluginAPI::PluginAPI::TextPlacement values.
979 0 : API_PROPERTY(endTextPlace, END_TEXT_PLACE)
980 : /// For text-line-based elements, the hook type at their end,
981 : /// one of PluginAPI::PluginAPI::HookType values.
982 0 : API_PROPERTY(endHookType, END_HOOK_TYPE)
983 : /// For text-line-based elements, the height of the hook at their end.
984 0 : API_PROPERTY(endHookHeight, END_HOOK_HEIGHT)
985 : /// For text-line-based elements, the height of the line arrow at their end.
986 0 : API_PROPERTY(endLineArrowHeight, END_LINE_ARROW_HEIGHT)
987 : /// For text-line-based elements, the height of the line arrow at their end.
988 0 : API_PROPERTY(endLineArrowWidth, END_LINE_ARROW_WIDTH)
989 : /// For text-line-based elements, the height of the line arrow at their end.
990 0 : API_PROPERTY(endFilledArrowHeight, END_FILLED_ARROW_HEIGHT)
991 : /// For text-filled-based elements, the height of the filled arrow at their end.
992 0 : API_PROPERTY(endFilledArrowWidth, END_FILLED_ARROW_WIDTH)
993 : /// For text-line-based elements, the font face of the ending text.
994 0 : API_PROPERTY(endFontFace, END_FONT_FACE)
995 : /// For text-line-based elements, the font size of the ending text.
996 0 : API_PROPERTY_T(qreal, endFontSize, END_FONT_SIZE)
997 : /// For text-line-based elements, the font style of the ending text.
998 0 : API_PROPERTY_T(int, endFontStyle, END_FONT_STYLE)
999 : /// For text-line-based elements, the offset face of the ending text.
1000 0 : API_PROPERTY_T(QPointF, endTextOffset, END_TEXT_OFFSET)
1001 :
1002 : /// For note-anchored-lines: Controls their placement relative to notes.
1003 : /// One of PluginAPI::PluginAPI::NoteLineEndPlacement values.
1004 : ///\since MuseScore 4.6
1005 0 : API_PROPERTY(notelinePlacement, NOTELINE_PLACEMENT)
1006 :
1007 : /// For lyrics and dynamics: Whether they avoid barlines on layout.
1008 : ///\since MuseScore 4.6
1009 0 : API_PROPERTY_T(bool, avoidBarLines, AVOID_BARLINES)
1010 : /// For dynamics: Their scale.
1011 : ///\since MuseScore 4.6
1012 0 : API_PROPERTY_T(qreal, dynamicsSize, DYNAMICS_SIZE)
1013 : /// For dynamics: Whether they center on the notehead
1014 : ///\since MuseScore 4.6
1015 0 : API_PROPERTY_T(bool, centerOnNotehead, CENTER_ON_NOTEHEAD)
1016 : /// For dynamics: Whether they anchor to end of the preceding segment.
1017 : ///\since MuseScore 4.6
1018 0 : API_PROPERTY_T(bool, anchorToEndOfPrevious, ANCHOR_TO_END_OF_PREVIOUS)
1019 :
1020 : /// For expressions: Whether they align themselves to an accompanying dynamic
1021 : ///\since MuseScore 4.6
1022 0 : API_PROPERTY_T(bool, snapToDynamics, SNAP_TO_DYNAMICS)
1023 : /// For hairpins and gradual tempo changes:
1024 : /// Whether they snap to the preceding element.
1025 : ///\since MuseScore 4.6
1026 0 : API_PROPERTY_T(bool, snapBefore, SNAP_BEFORE)
1027 : /// For hairpins and gradual tempo changes:
1028 : /// Whether they snap to the succeeding element.
1029 : ///\since MuseScore 4.6
1030 0 : API_PROPERTY_T(bool, snapAfter, SNAP_AFTER)
1031 :
1032 : /// The voice assignment properties for this element,
1033 : /// one of PluginAPI::PluginAPI::VoiceAssignment values.
1034 : ///\since MuseScore 4.6
1035 0 : API_PROPERTY(voiceAssignment, VOICE_ASSIGNMENT)
1036 : /// Whether this element centers itself between staves,
1037 : /// one of PluginAPI::PluginAPI::AutoOnOff values.
1038 : ///\since MuseScore 4.6
1039 0 : API_PROPERTY(centerBetweenStaves, CENTER_BETWEEN_STAVES)
1040 :
1041 0 : API_PROPERTY(posAbove, POS_ABOVE)
1042 :
1043 : ///\since MuseScore 4.6
1044 0 : API_PROPERTY_T(int, locationStaves, LOCATION_STAVES)
1045 : ///\since MuseScore 4.6
1046 0 : API_PROPERTY_T(int, locationVoices, LOCATION_VOICES)
1047 : ///\since MuseScore 4.6
1048 0 : API_PROPERTY_T(int, locationMeasures, LOCATION_MEASURES)
1049 : ///\since MuseScore 4.6
1050 0 : API_PROPERTY(locationFractions, LOCATION_FRACTIONS)
1051 : ///\since MuseScore 4.6
1052 0 : API_PROPERTY_T(int, locationGrace, LOCATION_GRACE)
1053 : ///\since MuseScore 4.6
1054 0 : API_PROPERTY_T(int, locationNote, LOCATION_NOTE)
1055 :
1056 : /// The voice of this element.
1057 0 : API_PROPERTY_T(int, voice, VOICE)
1058 :
1059 0 : API_PROPERTY(position, POSITION)
1060 :
1061 : /// For clefs: The clef type in concert pitch.
1062 : ///\since MuseScore 4.6
1063 0 : API_PROPERTY(concertClefType, CLEF_TYPE_CONCERT)
1064 : /// For clefs: The clef type in transposed pitch.
1065 : ///\since MuseScore 4.6
1066 0 : API_PROPERTY(transposingClefType, CLEF_TYPE_TRANSPOSING)
1067 : /// For clefs: The position relative to the barline,
1068 : /// one of PluginAPI::PluginAPI::ClefToBarlinePosition values.
1069 : ///\since MuseScore 4.6
1070 0 : API_PROPERTY_T(int, clefToBarlinePos, CLEF_TO_BARLINE_POS)
1071 : /// Whether this clef is a header clef.
1072 : ///\since MuseScore 4.6
1073 : Q_PROPERTY(bool isHeader READ isHeader)
1074 : /// For key signatures: The key in concert pitch.
1075 : ///\since MuseScore 4.6
1076 0 : API_PROPERTY_T(int, concertKey, KEY_CONCERT)
1077 : /// For key signatures: The actual key.
1078 : ///\since MuseScore 4.6
1079 0 : API_PROPERTY_T(int, actualKey, KEY)
1080 : ///\since MuseScore 4.6
1081 0 : API_PROPERTY(action, ACTION)
1082 : /// The minimum vertical distance between this element and other elements.
1083 : ///\since MuseScore 4.6
1084 0 : API_PROPERTY(minDistance, MIN_DISTANCE)
1085 :
1086 : /// For arpeggios: The arpeggio type, one of
1087 : /// PluginAPI::PluginAPI::ArpeggioType values.
1088 : ///\since MuseScore 4.6
1089 0 : API_PROPERTY_T(int, arpeggioType, ARPEGGIO_TYPE)
1090 : /// For chord lines: The chord line type, one of
1091 : /// PluginAPI::PluginAPI::ChordLineType values.
1092 : ///\since MuseScore 4.6
1093 0 : API_PROPERTY_T(int, chordLineType, CHORD_LINE_TYPE)
1094 : /// Whether this chord line is straight.
1095 : ///\since MuseScore 4.6
1096 0 : API_PROPERTY_T(bool, chordLineStraight, CHORD_LINE_STRAIGHT)
1097 : /// Whether this chord line is wavy.
1098 : ///\since MuseScore 4.6
1099 0 : API_PROPERTY_T(bool, chordLineWavy, CHORD_LINE_WAVY)
1100 : /// For tremolos: The tremolo type, one of
1101 : /// PluginAPI::PluginAPI::TremoloType values.
1102 : ///\since MuseScore 4.6
1103 0 : API_PROPERTY_T(int, tremoloType, TREMOLO_TYPE)
1104 : /// For half-note two-chord tremolos: The tremolo style.
1105 : /// One of PluginAPI::PluginAPI::TremoloStyle values.
1106 : ///\since MuseScore 4.6
1107 0 : API_PROPERTY_T(int, tremoloStrokeStyle, TREMOLO_STYLE)
1108 : /// For chord symbols, chord symbol type, one of
1109 : /// PluginAPI::PluginAPI::HarmonyType values.
1110 : /// \since MuseScore 3.6
1111 0 : API_PROPERTY_T(int, harmonyType, HARMONY_TYPE)
1112 :
1113 : /// For arpeggios: The number of tracks it spans.
1114 : ///\since MuseScore 4.6
1115 0 : API_PROPERTY_T(int, arpeggioSpan, ARPEGGIO_SPAN)
1116 :
1117 : /// For chord brackets: The vertical length of their hook(s)
1118 0 : API_PROPERTY(bracketHookLength, BRACKET_HOOK_LEN)
1119 : /// For chord brackets: Which hooks the chord bracket has.
1120 : /// One of PluginAPI::PluginAPI::Direction values.
1121 0 : API_PROPERTY_T(int, bracketHookPos, BRACKET_HOOK_POS)
1122 : /// For chord brackets: Whether this chord bracket
1123 : /// is placed on the right side of the chord.
1124 0 : API_PROPERTY_T(bool, bracketRightSide, BRACKET_RIGHT_SIDE)
1125 :
1126 : /// For (obsolete) bends: The bend type.
1127 : ///\since MuseScore 4.6
1128 0 : API_PROPERTY_T(int, bendType, BEND_TYPE)
1129 : /// For (obsolete) bends: The bend curve.
1130 : ///\since MuseScore 4.6
1131 0 : API_PROPERTY(bendCurve, BEND_CURVE)
1132 : /// For guitar bends: The offset for the bend's midpoint.
1133 : ///\since MuseScore 4.6
1134 0 : API_PROPERTY_T(QPointF, bendVertexOffset, BEND_VERTEX_OFF)
1135 : /// For gutar bends: Whether to show the hold line,
1136 : /// one of PluginAPI::PluginAPI::GuitarBendShowHoldLine values.
1137 : ///\since MuseScore 4.6
1138 0 : API_PROPERTY_T(int, bendShowHoldLine, BEND_SHOW_HOLD_LINE)
1139 : /// For guitar bends: When to start the bend.
1140 : ///\since MuseScore 4.6
1141 0 : API_PROPERTY_T(qreal, bendStartTimeFactor, BEND_START_TIME_FACTOR)
1142 : /// For guitar bends: When to end the bend.
1143 : ///\since MuseScore 4.6
1144 0 : API_PROPERTY_T(qreal, bendEndTimeFactor, BEND_END_TIME_FACTOR)
1145 : /// For guitar dives: Whether it is placed above tablature staves.
1146 : /// One of PluginAPI::PluginAPI::Direction values.
1147 0 : API_PROPERTY_T(int, guitarDiveTabPos, GUITAR_DIVE_TAB_POS)
1148 : /// For guitar bends: The bend amount, in quarter tones.
1149 0 : API_PROPERTY_T(int, guitarBendAmount, GUITAR_BEND_AMOUNT)
1150 : /// For guitar dips: The vibrato type of the line component.
1151 : /// One of PluginAPI::PluginAPI::VibratoType values.
1152 0 : API_PROPERTY_T(int, vibratoLineType, VIBRATO_LINE_TYPE)
1153 : /// For guitar dives: Whether this dive is a slack.
1154 0 : API_PROPERTY_T(bool, guitarDiveIsSlack, GUITAR_DIVE_IS_SLACK)
1155 :
1156 : /// For tremolo bars: The tremolo bar type,
1157 : /// one of PluginAPI::PluginAPI::TremoloBarType values.
1158 : ///\since MuseScore 4.6
1159 0 : API_PROPERTY_T(int, tremoloBarType, TREMOLOBAR_TYPE)
1160 : /// For tremolo bars: The tremolo bar curve.
1161 : ///\since MuseScore 4.6
1162 0 : API_PROPERTY(tremoloBarCurve, TREMOLOBAR_CURVE)
1163 :
1164 : /// For section breaks: Whether to start the next measure with long names
1165 : ///\since MuseScore 4.6
1166 0 : API_PROPERTY_T(bool, startWithLongNames, START_WITH_LONG_NAMES)
1167 : /// For section breaks: Whether to reset the measure number for the next measure
1168 : ///\since MuseScore 4.6
1169 0 : API_PROPERTY_T(bool, startWithMeasureOne, START_WITH_MEASURE_ONE)
1170 : /// For section breaks: Whether to add an indentation before the next measure
1171 : ///\since MuseScore 4.6
1172 0 : API_PROPERTY_T(bool, firstSystemIndentation, FIRST_SYSTEM_INDENTATION)
1173 :
1174 : /// For parts: Whether this part prefers sharps or flats,
1175 : /// one of PluginAPI::PluginAPI::PreferSharpFlat values.
1176 : ///\since MuseScore 4.6
1177 0 : API_PROPERTY_T(int, preferSharpFlat, PREFER_SHARP_FLAT)
1178 :
1179 : /// For playing technique annotations: Their type,
1180 : /// one of PluginAPI::PluginAPI::PlayingTechniqueType values.
1181 : ///\since MuseScore 4.6
1182 0 : API_PROPERTY(playTechType, PLAY_TECH_TYPE)
1183 :
1184 : /// For gradual tempo changes: Their type,
1185 : /// one of PluginAPI::PluginAPI::GradualTempoChangeType values.
1186 : ///\since MuseScore 4.6
1187 0 : API_PROPERTY(tempoChangeType, TEMPO_CHANGE_TYPE)
1188 : /// The way a gradual tempo change interpolates between values.
1189 : /// one of PluginAPI::PluginAPI::ChangeMethod values
1190 : ///\since MuseScore 4.6
1191 0 : API_PROPERTY(tempoEasingMethod, TEMPO_EASING_METHOD)
1192 : /// For gradual tempo changes: The factor by which to change
1193 : /// the tempo, relative to the old tempo.
1194 : ///\since MuseScore 4.6
1195 0 : API_PROPERTY_T(qreal, tempoChangeFactor, TEMPO_CHANGE_FACTOR)
1196 :
1197 : /// For harp diagrams: Whether this diagram is a diagram,
1198 : /// as opposed to text.
1199 : ///\since MuseScore 4.6
1200 0 : API_PROPERTY_T(bool, isDiagram, HARP_IS_DIAGRAM)
1201 :
1202 : /// For capos: Whether a capo is active and affects the sore.
1203 : ///\since MuseScore 4.6
1204 0 : API_PROPERTY_T(bool, active, ACTIVE)
1205 :
1206 : /// For capos: The fret position of the capo.
1207 : ///\since MuseScore 4.6
1208 0 : API_PROPERTY_T(int, fretPosition, CAPO_FRET_POSITION)
1209 : /// For capos: The ignored strings of the capo.
1210 : ///\since MuseScore 4.6
1211 0 : API_PROPERTY(ignoredStrings, CAPO_IGNORED_STRINGS)
1212 : /// For capos: If the capo should automatically generate text.
1213 : ///\since MuseScore 4.6
1214 0 : API_PROPERTY_T(bool, generateText, CAPO_GENERATE_TEXT)
1215 : /// For capos: Capo transposition behaviour. PLAYBACK_ONLY = 0, NOTATION_ONLY = 1, TAB_ONLY = 2,
1216 : ///\since MuseScore 4.6
1217 0 : API_PROPERTY_T(int, transposeMode, CAPO_TRANSPOSE_MODE)
1218 :
1219 : /// For tie elements: Their tie placement, one of
1220 : /// PluginAPI::PluginAPI::TiePlacement values.
1221 : ///\since MuseScore 4.6
1222 0 : API_PROPERTY(tiePlacement, TIE_PLACEMENT)
1223 : /// For laissez vibrer elements: Their minimum length in spatiums.
1224 : ///\since MuseScore 4.6
1225 0 : API_PROPERTY(minLength, MIN_LENGTH)
1226 : /// For partial ties and slurs: Their partial spanner direction,
1227 : /// one of PluginAPI::PluginAPI::PartialSpannerDirection alues.
1228 : ///\since MuseScore 4.6
1229 0 : API_PROPERTY(partialSpannerDirection, PARTIAL_SPANNER_DIRECTION)
1230 :
1231 : /// If the position of this part score element is linked to the main score.
1232 : ///\since MuseScore 4.6
1233 0 : API_PROPERTY_T(bool, positionLinkedToMaster, POSITION_LINKED_TO_MASTER)
1234 : /// If the appearance of this part score element is linked to the main score.
1235 : ///\since MuseScore 4.6
1236 0 : API_PROPERTY_T(bool, appearanceLinkedToMaster, APPEARANCE_LINKED_TO_MASTER)
1237 : /// If the text of this part score element is linked to the main score.
1238 : ///\since MuseScore 4.6
1239 0 : API_PROPERTY_T(bool, textLinkedToMaster, TEXT_LINKED_TO_MASTER)
1240 : /// If this element is included in the main score as well as the part score.
1241 : ///\since MuseScore 4.6
1242 0 : API_PROPERTY_T(bool, excludeFromParts, EXCLUDE_FROM_OTHER_PARTS)
1243 :
1244 : /// For string tunings: The number of strings to tune.
1245 : ///\since MuseScore 4.6
1246 0 : API_PROPERTY_T(int, stringsCount, STRINGTUNINGS_STRINGS_COUNT)
1247 : /// For string tunings: The active preset tuning setting.
1248 : ///\since MuseScore 4.6
1249 0 : API_PROPERTY(preset, STRINGTUNINGS_PRESET)
1250 : /// For string tunings: Which tuned strings to display in the score.
1251 : ///\since MuseScore 4.6
1252 0 : API_PROPERTY(visibleStrings, STRINGTUNINGS_VISIBLE_STRINGS)
1253 :
1254 : /// For symbols: Their musical symbols font face.
1255 : ///\since MuseScore 4.6
1256 0 : API_PROPERTY(scoreFont, SCORE_FONT)
1257 : /// For symbols: Their scale.
1258 : ///\since MuseScore 4.6
1259 0 : API_PROPERTY_T(qreal, symbolsSize, SYMBOLS_SIZE)
1260 : /// For symbols: Their rotation angle.
1261 : ///\since MuseScore 4.6
1262 0 : API_PROPERTY_T(qreal, symbolAngle, SYMBOL_ANGLE)
1263 :
1264 : /// For sound flags: Whether they apply to all staves.
1265 : ///\since MuseScore 4.6
1266 0 : API_PROPERTY_T(bool, applyToAllStaves, APPLY_TO_ALL_STAVES)
1267 : /// For key signatures, clefs, and time signatures:
1268 : /// Whether this element is a courtesy element.
1269 : ///\since MuseScore 4.6
1270 0 : API_PROPERTY_T(bool, isCourtesy, IS_COURTESY)
1271 : /// Whether this fretboard diagram is excluded from vertical alignnment.
1272 : ///\since MuseScore 4.6
1273 0 : API_PROPERTY_T(bool, excludeVerticalAlign, EXCLUDE_VERTICAL_ALIGN)
1274 :
1275 : /// For barlines & play count text: Controls how to display the play count text.
1276 : /// One of PluginAPI::PluginAPI::AutoCustomHide values.
1277 0 : API_PROPERTY(playCountTextSetting, PLAY_COUNT_TEXT_SETTING)
1278 : /// For barlines & play count text: Controls the text of the play count text.
1279 0 : API_PROPERTY(playCountText, PLAY_COUNT_TEXT)
1280 :
1281 : /// For rests: Whether to vertically align them with other rests in the same voice.
1282 : /// \since MuseScore 4.6
1283 0 : API_PROPERTY_T(bool, alignWithOtherRests, ALIGN_WITH_OTHER_RESTS)
1284 :
1285 : // API_PROPERTY(end, END)
1286 :
1287 0 : qreal offsetX() const { return element()->offset().x() / element()->spatium(); }
1288 0 : qreal offsetY() const { return element()->offset().y() / element()->spatium(); }
1289 : void setOffsetX(qreal offX);
1290 : void setOffsetY(qreal offY);
1291 :
1292 : QVariant mmRestNumberPos() const;
1293 : void setMmRestNumberPos(const QVariant& pos);
1294 : void resetMmRestNumberPos();
1295 : QVariant measureRepeatNumberPos() const;
1296 : void setMeasureRepeatNumberPos(const QVariant& pos);
1297 : void resetMeasureRepeatNumberPos();
1298 :
1299 0 : qreal posX() const { return element()->pos().x() / element()->spatium(); }
1300 0 : qreal posY() const { return element()->pos().y() / element()->spatium(); }
1301 :
1302 0 : QPointF pos() const { return PointF(element()->pos() / element()->spatium()).toQPointF(); }
1303 0 : QPointF pagePos() const { return PointF(element()->pagePos() / element()->spatium()).toQPointF(); }
1304 0 : QPointF canvasPos() const { return PointF(element()->canvasPos() / element()->spatium()).toQPointF(); }
1305 :
1306 : //! \note Plugins have always seen the visual parent here (a measure reports
1307 : //! its system, a spanner segment its system), so keep layoutParent().
1308 0 : apiv1::EngravingItem* parent() const { return wrap(element()->layoutParent()); }
1309 0 : Staff* staff() { return wrap<Staff>(element()->staff()); }
1310 :
1311 : QRectF bbox() const;
1312 :
1313 0 : int subtype() const { return element()->subtype(); }
1314 :
1315 0 : int staffIdx() const { return int(element()->staffIdx()); }
1316 0 : int effectiveStaffIdx() const { return int(element()->effectiveStaffIdx()); }
1317 0 : int vStaffIdx() const { return int(element()->vStaffIdx()); }
1318 :
1319 : bool up() const;
1320 : bool isHeader() const;
1321 :
1322 : /// \brief Current tick for this element
1323 : /// \returns Tick of this element, i.e. fraction of ticks from the beginning
1324 : /// of the score to this element. Not valid for all elements.
1325 : /// For the integer value, call \ref fraction.ticks
1326 : /// \see \ref ticklength
1327 : /// \since MuseScore 4.6
1328 : Q_PROPERTY(apiv1::Fraction * fraction READ tick)
1329 : /// \brief Current beat of this element
1330 : /// \returns The beat this element starts on, as a fraction.
1331 : /// \since MuseScore 4.6
1332 : Q_PROPERTY(apiv1::Fraction * beat READ beat)
1333 :
1334 : public:
1335 : /// \cond MS_INTERNAL
1336 9 : EngravingItem(mu::engraving::EngravingItem* e = nullptr, Ownership own = Ownership::PLUGIN)
1337 9 : : apiv1::ScoreElement(e, own) {}
1338 :
1339 : /// \brief muse::Returns the underlying mu::engraving::EngravingItem
1340 : /// \{
1341 0 : mu::engraving::EngravingItem* element() { return toEngravingItem(e); }
1342 0 : const mu::engraving::EngravingItem* element() const { return toEngravingItem(e); }
1343 : /// \}
1344 :
1345 0 : bool header() { return element()->header(); }
1346 0 : bool trailer() { return element()->trailer(); }
1347 0 : virtual bool isMovable() { return element()->isMovable(); }
1348 0 : bool enabled() { return element()->enabled(); }
1349 0 : bool addToSkyline() { return element()->addToSkyline(); }
1350 : bool generated() { return element()->generated(); }
1351 : /// \endcond
1352 :
1353 : /// Create a copy of the element
1354 0 : Q_INVOKABLE apiv1::EngravingItem* clone() const { return wrap(element()->clone(), Ownership::PLUGIN); }
1355 :
1356 0 : Q_INVOKABLE QString subtypeName() const { return element()->translatedSubtypeUserName().toQString(); }
1357 : /// Deprecated: same as ScoreElement::name. Left for compatibility purposes.
1358 0 : Q_INVOKABLE QString _name() const { return name(); }
1359 :
1360 : Fraction* tick() const;
1361 : Fraction* beat() const;
1362 : };
1363 :
1364 : //---------------------------------------------------------
1365 : // Note
1366 : // Note wrapper
1367 : //---------------------------------------------------------
1368 :
1369 : class Note : public EngravingItem
1370 : {
1371 : Q_OBJECT
1372 : Q_PROPERTY(apiv1::EngravingItem * accidental READ accidental)
1373 : Q_PROPERTY(mu::engraving::AccidentalType accidentalType READ accidentalType WRITE setAccidentalType)
1374 : /// List of dots attached to this note
1375 : Q_PROPERTY(QQmlListProperty<apiv1::EngravingItem> dots READ dots)
1376 : // Q_PROPERTY(int dotsCount READ qmlDotsCount)
1377 : /// List of other elements attached to this note: fingerings, symbols, bends etc.
1378 : Q_PROPERTY(QQmlListProperty<apiv1::EngravingItem> elements READ elements)
1379 : /// List of PlayEvents associated with this note.
1380 : /// Important: You must call Score.createPlayEvents()
1381 : /// to see meaningful data in the PlayEvent lists.
1382 : /// \since MuseScore 3.3
1383 : Q_PROPERTY(QQmlListProperty<apiv1::PlayEvent> playEvents READ playEvents)
1384 : /// List of spanners attached to and starting on this note
1385 : /// e.g. glissandos, guitar bends
1386 : /// \since MuseScore 4.6
1387 : Q_PROPERTY(QQmlListProperty<apiv1::EngravingItem> spannerForward READ spannerFor)
1388 : /// List of spanners attached to and ending on this note
1389 : /// \since MuseScore 4.6
1390 : Q_PROPERTY(QQmlListProperty<apiv1::EngravingItem> spannerBack READ spannerBack)
1391 : // Q_PROPERTY(bool ghost READ ghost WRITE undoSetGhost)
1392 : // Q_PROPERTY(mu::engraving::NoteHead::Group headGroup READ headGroup WRITE undoSetHeadGroup)
1393 : // Q_PROPERTY(mu::engraving::NoteHead::Type headType READ headType WRITE undoSetHeadType)
1394 : // Q_PROPERTY(bool hidden READ hidden)
1395 : // Q_PROPERTY(bool mirror READ mirror)
1396 : // Q_PROPERTY(int ppitch READ ppitch)
1397 : // Q_PROPERTY(bool small READ isSmall WRITE undoSetSmall)
1398 : // Q_PROPERTY(int string READ string WRITE undoSetString)
1399 : // Q_PROPERTY(int subchannel READ subchannel)
1400 : /// Backward tie for this Note.
1401 : /// \since MuseScore 3.3
1402 : Q_PROPERTY(apiv1::Tie * tieBack READ tieBack)
1403 : /// Forward tie for this Note.
1404 : /// \since MuseScore 3.3
1405 : Q_PROPERTY(apiv1::Tie * tieForward READ tieForward)
1406 : /// The first note of a series of ties to this note.
1407 : /// This will return the calling note if there is not tieBack.
1408 : /// \since MuseScore 3.3
1409 : Q_PROPERTY(apiv1::Note * firstTiedNote READ firstTiedNote)
1410 : /// The last note of a series of ties to this note.
1411 : /// This will return the calling note if there is not tieForward.
1412 : /// \since MuseScore 3.3
1413 : Q_PROPERTY(apiv1::Note * lastTiedNote READ lastTiedNote)
1414 : /// The NoteType of the note.
1415 : /// \since MuseScore 3.2.1
1416 : Q_PROPERTY(mu::engraving::NoteType noteType READ noteType)
1417 :
1418 : /// MIDI pitch of this note
1419 : /// \see \ref pitch
1420 0 : API_PROPERTY_T(int, pitch, PITCH)
1421 : /// Concert pitch of the note
1422 : /// \see \ref tpc
1423 0 : API_PROPERTY_T(int, tpc1, TPC1)
1424 : /// Transposing pitch of the note
1425 : /// \see \ref tpc
1426 0 : API_PROPERTY_T(int, tpc2, TPC2)
1427 : /// Concert or transposing pitch of this note,
1428 : /// as per current "Concert Pitch" setting value.
1429 : /// \see \ref tpc
1430 : Q_PROPERTY(int tpc READ tpc WRITE setTpc)
1431 : /// The position of a note's dot, one of
1432 : /// PluginAPI::PluginAPI::Direction values.
1433 0 : API_PROPERTY(dotPosition, DOT_POSITION)
1434 : /// See PluginAPI::PluginAPI::NoteValueType
1435 0 : API_PROPERTY(veloType, VELO_TYPE)
1436 : /// The velocity of this note.
1437 0 : API_PROPERTY_T(int, userVelocity, USER_VELOCITY)
1438 : /// The tuning of this note, in cents.
1439 0 : API_PROPERTY_T(qreal, tuning, TUNING)
1440 :
1441 : /// For notes on non-tab staves: the line this note is on.
1442 0 : API_PROPERTY_T(int, line, LINE)
1443 : /// For notes on non-tab staves: Whether this note is
1444 : /// fixed to a specific line, irrespective of its pitch.
1445 0 : API_PROPERTY_T(bool, fixed, FIXED)
1446 : /// For notes on non-tab staves: if \p fixed is true,
1447 : /// the line this note is fixed to.
1448 0 : API_PROPERTY_T(int, fixedLine, FIXED_LINE)
1449 :
1450 : /// For notes on tab staves: The fret this note is on.
1451 0 : API_PROPERTY_T(int, fret, FRET)
1452 : /// For notes on tab staves: The string this note is on.
1453 0 : API_PROPERTY_T(int, string, STRING)
1454 : ///\since MuseScore 4.6
1455 0 : API_PROPERTY_T(bool, dead, DEAD)
1456 : /// If the note is a trill cue note (used in ornaments and trills)
1457 : /// \since MuseScore 4.6
1458 : Q_PROPERTY(bool isTrillCueNote READ isTrillCueNote)
1459 :
1460 : public:
1461 : /// \cond MS_INTERNAL
1462 0 : Note(mu::engraving::Note* c = nullptr, Ownership own = Ownership::PLUGIN)
1463 0 : : EngravingItem(c, own) {}
1464 :
1465 0 : mu::engraving::Note* note() { return toNote(e); }
1466 0 : const mu::engraving::Note* note() const { return toNote(e); }
1467 :
1468 0 : int tpc() const { return note()->tpc(); }
1469 : void setTpc(int val);
1470 :
1471 0 : bool isTrillCueNote() { return note()->isTrillCueNote(); }
1472 :
1473 0 : apiv1::Tie* tieBack() const { return wrap<Tie>(note()->tieBack()); }
1474 0 : apiv1::Tie* tieForward() const { return wrap<Tie>(note()->tieFor()); }
1475 :
1476 0 : apiv1::Note* firstTiedNote() { return wrap<Note>(note()->firstTiedNote()); }
1477 0 : apiv1::Note* lastTiedNote() { return wrap<Note>(note()->lastTiedNote()); }
1478 :
1479 0 : QQmlListProperty<EngravingItem> dots() { return wrapContainerProperty<EngravingItem>(this, note()->dots()); }
1480 0 : QQmlListProperty<EngravingItem> elements() { return wrapContainerProperty<EngravingItem>(this, note()->el()); }
1481 0 : QQmlListProperty<PlayEvent> playEvents() { return wrapPlayEventsContainerProperty(this, note()->playEvents()); }
1482 :
1483 0 : QQmlListProperty<EngravingItem> spannerFor()
1484 : {
1485 0 : return wrapContainerProperty<EngravingItem>(this, note()->spannerFor());
1486 : }
1487 :
1488 0 : QQmlListProperty<EngravingItem> spannerBack()
1489 : {
1490 0 : return wrapContainerProperty<EngravingItem>(this, note()->spannerBack());
1491 : }
1492 :
1493 0 : EngravingItem* accidental() { return wrap<EngravingItem>(note()->accidental()); }
1494 :
1495 0 : mu::engraving::AccidentalType accidentalType() { return note()->accidentalType(); }
1496 0 : void setAccidentalType(mu::engraving::AccidentalType t) { note()->setAccidentalType(t); }
1497 0 : mu::engraving::NoteType noteType() { return note()->noteType(); }
1498 :
1499 : static void addInternal(mu::engraving::Note* note, mu::engraving::EngravingItem* el);
1500 : static bool isChildAllowed(mu::engraving::ElementType elementType);
1501 : /// \endcond
1502 :
1503 : /// Creates a PlayEvent object for use in JavaScript.
1504 : /// \since MuseScore 3.3
1505 0 : Q_INVOKABLE apiv1::PlayEvent* createPlayEvent() { return playEventWrap(new engraving::NoteEvent(), nullptr); }
1506 :
1507 : /// Add to a note's elements.
1508 : /// \since MuseScore 3.3.3
1509 : Q_INVOKABLE void add(apiv1::EngravingItem* wrapped);
1510 : /// Remove a note's element.
1511 : /// \since MuseScore 3.3.3
1512 : Q_INVOKABLE void remove(apiv1::EngravingItem* wrapped);
1513 : };
1514 :
1515 : //---------------------------------------------------------
1516 : // DurationElement
1517 : //---------------------------------------------------------
1518 :
1519 : class DurationElement : public EngravingItem
1520 : {
1521 : Q_OBJECT
1522 :
1523 : /// Nominal duration of this element.
1524 : /// The duration is represented as a fraction of whole note length.
1525 : /// This property can be modified for chords and rests since MuseScore 4.6
1526 : // prior to 4.6 this was called as API_PROPERTY_READ_ONLY(duration, DURATION).
1527 : Q_PROPERTY(apiv1::Fraction * duration READ ticks WRITE changeCRlen)
1528 :
1529 : /// Global duration of this element, taking into account ratio of
1530 : /// parent tuplets if there are any.
1531 : /// \since MuseScore 3.5
1532 : Q_PROPERTY(apiv1::Fraction * globalDuration READ globalDuration)
1533 :
1534 : /// Actual duration of this element, taking into account ratio of
1535 : /// parent tuplets and local time signatures if there are any.
1536 : /// \since MuseScore 3.5
1537 : Q_PROPERTY(apiv1::Fraction * actualDuration READ actualDuration)
1538 :
1539 : /// Tuplet which this element belongs to. If there is no parent tuplet, returns null.
1540 : /// \since MuseScore 3.5
1541 : Q_PROPERTY(apiv1::Tuplet * tuplet READ parentTuplet)
1542 :
1543 : /// Outermost tuplet which this element belongs to. If there is no parent tuplet, returns null.
1544 : /// \since MuseScore 4.6
1545 : Q_PROPERTY(apiv1::Tuplet * topTuplet READ topTuplet)
1546 :
1547 : /// Measure which this element belongs to.
1548 : /// \since MuseScore 4.6
1549 : Q_PROPERTY(apiv1::Measure * measure READ parentMeasure)
1550 :
1551 : public:
1552 : /// \cond MS_INTERNAL
1553 0 : DurationElement(mu::engraving::DurationElement* de = nullptr, Ownership own = Ownership::PLUGIN)
1554 0 : : EngravingItem(de, own) {}
1555 :
1556 0 : mu::engraving::DurationElement* durationElement() { return toDurationElement(e); }
1557 0 : const mu::engraving::DurationElement* durationElement() const { return toDurationElement(e); }
1558 :
1559 : Fraction* ticks() const;
1560 : void changeCRlen(Fraction* len);
1561 : Fraction* globalDuration() const;
1562 : Fraction* actualDuration() const;
1563 :
1564 : Tuplet* parentTuplet();
1565 0 : Tuplet* topTuplet() { return wrap<Tuplet>(durationElement()->topTuplet(), Ownership::SCORE); }
1566 :
1567 0 : Measure* parentMeasure() { return wrap<Measure>(durationElement()->measure(), Ownership::SCORE); }
1568 : /// \endcond
1569 : };
1570 :
1571 : //---------------------------------------------------------
1572 : // Tuplet
1573 : //---------------------------------------------------------
1574 :
1575 : class Tuplet : public DurationElement
1576 : {
1577 : Q_OBJECT
1578 :
1579 : /// The number type of this tuplet, one of
1580 : /// PluginAPI::PluginAPI::TupletNumberType values.
1581 0 : API_PROPERTY_T(int, numberType, NUMBER_TYPE)
1582 : /// The bracket type of this tuplet, one of
1583 : /// PluginAPI::PluginAPI::TupletBracketType values.
1584 0 : API_PROPERTY_T(int, bracketType, BRACKET_TYPE)
1585 :
1586 : /// Whether this tuplet has a bracket.
1587 : /// \since MuseScore 4.6
1588 : Q_PROPERTY(bool hasBracket READ hasBracket)
1589 :
1590 : /// Actual number of notes of base nominal length in this tuplet.
1591 0 : API_PROPERTY_READ_ONLY_T(int, actualNotes, ACTUAL_NOTES)
1592 :
1593 : /// Number of "normal" notes of base nominal length which correspond
1594 : /// to this tuplet's duration.
1595 0 : API_PROPERTY_READ_ONLY_T(int, normalNotes, NORMAL_NOTES)
1596 :
1597 : /// The user offset for the left point of this tuplet, in spatium units.
1598 0 : API_PROPERTY_T(QPointF, p1, P1)
1599 : /// The user offset for the right point of this tuplet, in spatium units.
1600 0 : API_PROPERTY_T(QPointF, p2, P2)
1601 :
1602 : /// The actual position of the left point of this tuplet, in spatium units.
1603 : /// \since MuseScore 4.6
1604 : Q_PROPERTY(QPointF defaultP1 READ defaultP1)
1605 : /// The actual position of the right point of this tuplet, in spatium units.
1606 : /// \since MuseScore 4.6
1607 : Q_PROPERTY(QPointF defaultP2 READ defaultP2)
1608 :
1609 : /// List of elements which belong to this tuplet.
1610 : /// \since MuseScore 3.5
1611 : Q_PROPERTY(QQmlListProperty<apiv1::EngravingItem> elements READ elements)
1612 :
1613 : public:
1614 : /// \cond MS_INTERNAL
1615 0 : Tuplet(mu::engraving::Tuplet* t = nullptr, Ownership own = Ownership::PLUGIN)
1616 0 : : DurationElement(t, own) {}
1617 :
1618 0 : mu::engraving::Tuplet* tuplet() { return toTuplet(e); }
1619 0 : const mu::engraving::Tuplet* tuplet() const { return toTuplet(e); }
1620 :
1621 0 : bool hasBracket() { return tuplet()->hasBracket(); }
1622 :
1623 0 : QPointF defaultP1() const { return PointF(tuplet()->p1() / tuplet()->spatium()).toQPointF(); }
1624 0 : QPointF defaultP2() const { return PointF(tuplet()->p2() / tuplet()->spatium()).toQPointF(); }
1625 :
1626 0 : QQmlListProperty<EngravingItem> elements() { return wrapContainerProperty<EngravingItem>(this, tuplet()->elements()); }
1627 : /// \endcond
1628 : };
1629 :
1630 : //---------------------------------------------------------
1631 : // ChordRest
1632 : // ChordRest wrapper
1633 : //---------------------------------------------------------
1634 :
1635 : class ChordRest : public DurationElement
1636 : {
1637 : Q_OBJECT
1638 : /// Lyrics corresponding to this chord or rest, if any.
1639 : /// Before 3.6 version this property was only available for \ref Chord objects.
1640 : Q_PROPERTY(QQmlListProperty<apiv1::Lyrics> lyrics READ lyrics)
1641 : /// Beam which covers this chord/rest, if such exists.
1642 : /// \since MuseScore 3.6
1643 : Q_PROPERTY(apiv1::Beam * beam READ beam)
1644 : /// Whether this element is a full measure rest.
1645 : /// \since MuseScore 4.6
1646 : Q_PROPERTY(bool isFullMeasureRest READ isFullMeasureRest)
1647 :
1648 : /// For cross-staff chords and rests; The amount of staves this
1649 : /// chord or rest has been moved by.
1650 0 : API_PROPERTY_T(int, staffMove, STAFF_MOVE)
1651 0 : API_PROPERTY(durationTypeWithDots, DURATION_TYPE_WITH_DOTS)
1652 : /// The beam mode for this chord or rest, one of
1653 : /// PluginAPI::PluginAPI::BeamMode values.
1654 0 : API_PROPERTY(beamMode, BEAM_MODE)
1655 :
1656 : /// List of elements attached to this chord or rest,
1657 : /// such as fermatas or chord lines.
1658 : /// \since MuseScore 4.6
1659 : Q_PROPERTY(QQmlListProperty<apiv1::EngravingItem> elements READ elements)
1660 :
1661 : public:
1662 : /// \cond MS_INTERNAL
1663 0 : ChordRest(mu::engraving::ChordRest* c = nullptr, Ownership own = Ownership::PLUGIN)
1664 0 : : DurationElement(c, own) {}
1665 :
1666 0 : mu::engraving::ChordRest* chordRest() { return toChordRest(e); }
1667 : const mu::engraving::ChordRest* chordRest() const { return toChordRest(e); }
1668 :
1669 0 : QQmlListProperty<Lyrics> lyrics() { return wrapContainerProperty<Lyrics>(this, chordRest()->lyrics()); }
1670 0 : Beam* beam() { return wrap<Beam>(chordRest()->beam()); }
1671 :
1672 0 : bool isFullMeasureRest() { return chordRest()->isFullMeasureRest(); }
1673 :
1674 0 : QQmlListProperty<EngravingItem> elements() { return wrapContainerProperty<EngravingItem>(this, chordRest()->el()); }
1675 : /// \endcond
1676 :
1677 : /// The actual beam mode for this element, as determined by
1678 : /// user settings and the current time signature.
1679 : /// \param beamRests Whether to beam over rests
1680 : /// \since MuseScore 4.6
1681 : Q_INVOKABLE int actualBeamMode(bool beamRests = false);
1682 : };
1683 :
1684 : //---------------------------------------------------------
1685 : // Chord
1686 : // Chord wrapper
1687 : //---------------------------------------------------------
1688 :
1689 : class Chord : public ChordRest
1690 : {
1691 : Q_OBJECT
1692 : /// List of grace notes (grace chords) belonging to this chord.
1693 : Q_PROPERTY(QQmlListProperty<apiv1::Chord> graceNotes READ graceNotes)
1694 : /// List of grace notes (grace chords) placed before this chord.
1695 : /// \since MuseScore 4.6
1696 : Q_PROPERTY(QQmlListProperty<apiv1::Chord> graceNotesBefore READ graceNotesBefore)
1697 : /// List of grace notes (grace chords) placed after this chord.
1698 : /// \since MuseScore 4.6
1699 : Q_PROPERTY(QQmlListProperty<apiv1::Chord> graceNotesAfter READ graceNotesAfter)
1700 : /// List of notes belonging to this chord.
1701 : Q_PROPERTY(QQmlListProperty<apiv1::Note> notes READ notes)
1702 : /// List of articulations belonging to this chord.
1703 : /// \since MuseScore 4.6
1704 : Q_PROPERTY(QQmlListProperty<apiv1::EngravingItem> articulations READ articulations)
1705 : /// Stem of this chord, if exists. \since MuseScore 3.6
1706 : Q_PROPERTY(apiv1::EngravingItem * stem READ stem)
1707 : /// Stem slash of this chord, if exists. Stem slashes are present in grace notes of type acciaccatura.
1708 : /// \since MuseScore 3.6
1709 : Q_PROPERTY(apiv1::EngravingItem * stemSlash READ stemSlash)
1710 : /// Hook on a stem of this chord, if exists. \since MuseScore 3.6
1711 : Q_PROPERTY(apiv1::EngravingItem * hook READ hook)
1712 : /// The NoteType of the chord.
1713 : /// \since MuseScore 3.2.1
1714 : Q_PROPERTY(mu::engraving::NoteType noteType READ noteType)
1715 : /// The PlayEventType of the chord.
1716 : /// \since MuseScore 3.3
1717 : Q_PROPERTY(mu::engraving::PlayEventType playEventType READ playEventType WRITE setPlayEventType)
1718 :
1719 : /// Whether this chord is stemless. Does not override
1720 : /// its measure's or staff's stemless settings.
1721 0 : API_PROPERTY(noStem, NO_STEM)
1722 : ///\since MuseScore 4.6
1723 0 : API_PROPERTY_T(bool, showStemSlash, SHOW_STEM_SLASH)
1724 : ///\since MuseScore 4.6
1725 0 : API_PROPERTY(combineVoice, COMBINE_VOICE)
1726 : /// If the note is a trill cue note (used in ornaments and trills)
1727 : /// \since MuseScore 4.6
1728 : Q_PROPERTY(bool isTrillCueNote READ isTrillCueNote)
1729 : /// The top note in this chord.
1730 : /// \since MuseScore 4.6
1731 : Q_PROPERTY(apiv1::Note * upNote READ upNote)
1732 : /// The bottom note in this chord.
1733 : /// \since MuseScore 4.6
1734 : Q_PROPERTY(apiv1::Note * downNote READ downNote)
1735 : /// The arpeggio attached to this chord, if it exists.
1736 : /// \since MuseScore 4.6
1737 : Q_PROPERTY(apiv1::EngravingItem * arpeggio READ arpeggio)
1738 : /// The cross-voice arpeggio for this chord, if it exists.
1739 : /// \since MuseScore 4.6
1740 : Q_PROPERTY(apiv1::EngravingItem * spanArpeggio READ spanArpeggio)
1741 : /// The single-chord tremolo for this chord, if it exists.
1742 : /// \since MuseScore 4.6
1743 : Q_PROPERTY(apiv1::EngravingItem * tremoloSingleChord READ tremoloSingleChord)
1744 : /// The two-chord tremolo for this chord, if it exists.
1745 : /// \since MuseScore 4.6
1746 : Q_PROPERTY(apiv1::EngravingItem * tremoloTwoChord READ tremoloTwoChord)
1747 :
1748 : public:
1749 : /// \cond MS_INTERNAL
1750 0 : Chord(mu::engraving::Chord* c = nullptr, Ownership own = Ownership::PLUGIN)
1751 0 : : ChordRest(c, own) {}
1752 :
1753 0 : mu::engraving::Chord* chord() { return toChord(e); }
1754 : const mu::engraving::Chord* chord() const { return toChord(e); }
1755 :
1756 0 : QQmlListProperty<Chord> graceNotes() { return wrapContainerProperty<Chord>(this, chord()->graceNotes()); }
1757 0 : QQmlListProperty<Chord> graceNotesBefore() { return wrapContainerProperty<Chord>(this, chord()->graceNotesBefore()); }
1758 0 : QQmlListProperty<Chord> graceNotesAfter() { return wrapContainerProperty<Chord>(this, chord()->graceNotesAfter()); }
1759 0 : QQmlListProperty<Note> notes() { return wrapContainerProperty<Note>(this, chord()->notes()); }
1760 0 : QQmlListProperty<EngravingItem> articulations() { return wrapContainerProperty<EngravingItem>(this, chord()->articulations()); }
1761 0 : EngravingItem* stem() { return wrap(chord()->stem()); }
1762 0 : EngravingItem* stemSlash() { return wrap(chord()->stemSlash()); }
1763 0 : EngravingItem* hook() { return wrap(chord()->hook()); }
1764 0 : mu::engraving::NoteType noteType() { return chord()->noteType(); }
1765 0 : mu::engraving::PlayEventType playEventType() { return chord()->playEventType(); }
1766 : void setPlayEventType(mu::engraving::PlayEventType v);
1767 :
1768 0 : bool isTrillCueNote() { return chord()->isTrillCueNote(); }
1769 :
1770 0 : Note* upNote() { return wrap<Note>(chord()->upNote()); }
1771 0 : Note* downNote() { return wrap<Note>(chord()->downNote()); }
1772 0 : EngravingItem* arpeggio() { return wrap(chord()->arpeggio()); }
1773 0 : EngravingItem* spanArpeggio() { return wrap(chord()->spanArpeggio()); }
1774 0 : EngravingItem* tremoloSingleChord() { return wrap(chord()->tremoloSingleChord()); }
1775 0 : EngravingItem* tremoloTwoChord() { return wrap(chord()->tremoloTwoChord()); }
1776 :
1777 : static void addInternal(mu::engraving::Chord* chord, mu::engraving::EngravingItem* el);
1778 : /// \endcond
1779 :
1780 : /// Add to a chord's elements.
1781 : /// \since MuseScore 3.3
1782 : Q_INVOKABLE void add(apiv1::EngravingItem* wrapped);
1783 : /// Remove a chord's element.
1784 : /// \since MuseScore 3.3
1785 : Q_INVOKABLE void remove(apiv1::EngravingItem* wrapped);
1786 : };
1787 :
1788 : //---------------------------------------------------------
1789 : // Beam
1790 : /// \since MuseScore 4.7
1791 : //---------------------------------------------------------
1792 :
1793 : class Beam : public EngravingItem
1794 : {
1795 : Q_OBJECT
1796 :
1797 : /// The feathering on this beam's left side.
1798 0 : API_PROPERTY_T(qreal, growLeft, GROW_LEFT)
1799 : /// The feathering on this beam's right side.
1800 0 : API_PROPERTY_T(qreal, growRight, GROW_RIGHT)
1801 : /// Whether this beam is a cross-staff beam.
1802 : Q_PROPERTY(bool isCrossStaff READ cross)
1803 : /// Whether this beam is entirely on a different staff.
1804 : Q_PROPERTY(bool isFullCrossStaff READ fullCross)
1805 : /// The default cross staff position for this beam.
1806 : /// Add EngravingItem::crossStaffMove to get the actual position.
1807 : Q_PROPERTY(int defaultCrossStaffIdx READ defaultCrossStaffIdx)
1808 : /// The lowest possible cross staff position for this beam.
1809 : Q_PROPERTY(int minCRMove READ minCRMove)
1810 : /// The highest possible cross staff position for this beam.
1811 : Q_PROPERTY(int maxCRMove READ maxCRMove)
1812 : /// List of chords and rests which belong to this beam.
1813 : Q_PROPERTY(QQmlListProperty<apiv1::ChordRest> elements READ elements)
1814 :
1815 : public:
1816 : /// \cond MS_INTERNAL
1817 0 : Beam(mu::engraving::Beam* b = nullptr, Ownership own = Ownership::PLUGIN)
1818 0 : : EngravingItem(b, own) {}
1819 :
1820 0 : mu::engraving::Beam* beam() { return toBeam(e); }
1821 0 : const mu::engraving::Beam* beam() const { return toBeam(e); }
1822 :
1823 0 : bool cross() const { return beam()->cross(); }
1824 0 : bool fullCross() const { return beam()->fullCross(); }
1825 :
1826 0 : int defaultCrossStaffIdx() const { return beam()->defaultCrossStaffIdx(); }
1827 0 : int minCRMove() const { return beam()->minCRMove(); }
1828 0 : int maxCRMove() const { return beam()->maxCRMove(); }
1829 :
1830 0 : QQmlListProperty<ChordRest> elements() { return wrapContainerProperty<ChordRest>(this, beam()->elements()); }
1831 : /// \endcond
1832 : };
1833 :
1834 : //---------------------------------------------------------
1835 : // Segment
1836 : // Segment
1837 : //---------------------------------------------------------
1838 :
1839 : class Segment : public EngravingItem
1840 : {
1841 : Q_OBJECT
1842 : /// The added space preceding this segment.
1843 0 : API_PROPERTY(leadingSpace, LEADING_SPACE)
1844 : /// The list of annotations. Articulations, staff/system/expression
1845 : /// text are examples of what is considered to be segment annotations.
1846 : Q_PROPERTY(QQmlListProperty<apiv1::EngravingItem> annotations READ annotations)
1847 : /// \brief Next segment in this measure
1848 : /// \returns The next segment in this segment's measure.
1849 : /// Null if there is no such segment.
1850 : Q_PROPERTY(apiv1::Segment * nextInMeasure READ nextInMeasure)
1851 : /// \brief Next segment in this score.\ Doesn't stop at measure border.
1852 : /// \returns The next segment in this score. Null if there is
1853 : /// no such segment (i.e. this is the last segment in the score).
1854 : Q_PROPERTY(apiv1::Segment * next READ nextInScore)
1855 : /// \brief Previous segment in this measure
1856 : /// \returns The previous segment in this segment's measure.
1857 : /// Null if there is no such segment.
1858 : Q_PROPERTY(apiv1::Segment * prevInMeasure READ prevInMeasure)
1859 : /// \brief Previous segment in this score.\ Doesn't stop at measure border.
1860 : /// \returns The previous segment in this score. Null if there is
1861 : /// no such segment (i.e. this is the first segment in the score).
1862 : Q_PROPERTY(apiv1::Segment * prev READ prevInScore)
1863 : // segmentType was read&write in MuseScore 2.X plugin API.
1864 : // Allowing plugins to change random segments types doesn't seem to be a
1865 : // good idea though.
1866 : /// Type of this segment, one of PluginAPI::PluginAPI::Segment values.
1867 : Q_PROPERTY(int segmentType READ segmentType)
1868 : /// \brief Current tick for this segment
1869 : /// \returns Tick of this segment, i.e. number of ticks from the beginning
1870 : /// of the score to this segment.
1871 : /// \see \ref ticklength
1872 : Q_PROPERTY(int tick READ tick) // TODO: revise engraving (or this API):
1873 : // Pid::TICK is relative or absolute in different contexts
1874 : /// \brief Current tick fraction for this element
1875 : /// \returns Tick of this element, i.e. fraction of ticks from the beginning
1876 : /// of the score to this element. Not valid for all elements.
1877 : /// For the integer value, call \ref fraction.ticks
1878 : /// \see \ref ticklength
1879 : /// \since MuseScore 4.6
1880 : Q_PROPERTY(apiv1::Fraction * fraction READ fraction)
1881 :
1882 : public:
1883 : /// \cond MS_INTERNAL
1884 0 : Segment(mu::engraving::Segment* s = nullptr, Ownership own = Ownership::SCORE)
1885 0 : : EngravingItem(s, own) {}
1886 :
1887 0 : mu::engraving::Segment* segment() { return toSegment(e); }
1888 0 : const mu::engraving::Segment* segment() const { return toSegment(e); }
1889 :
1890 0 : int tick() const { return segment()->tick().ticks(); }
1891 : Fraction* fraction() const;
1892 :
1893 0 : int segmentType() const { return int(segment()->segmentType()); }
1894 :
1895 0 : Segment* nextInScore() { return wrap<Segment>(segment()->next1()); }
1896 0 : Segment* nextInMeasure() { return wrap<Segment>(segment()->next()); }
1897 0 : Segment* prevInScore() { return wrap<Segment>(segment()->prev1()); }
1898 0 : Segment* prevInMeasure() { return wrap<Segment>(segment()->prev()); }
1899 0 : QQmlListProperty<EngravingItem> annotations() { return wrapContainerProperty<EngravingItem>(this, segment()->annotations()); }
1900 : /// \endcond
1901 :
1902 : /// \returns Element at the given \p track (null if there is no such an element)
1903 : /// \param track track number
1904 : Q_INVOKABLE apiv1::EngravingItem* elementAt(int track);
1905 : };
1906 :
1907 : //---------------------------------------------------------
1908 : // MeasureBase
1909 : // MeasureBase wrapper (Measures, frames)
1910 : //---------------------------------------------------------
1911 : class MeasureBase : public EngravingItem
1912 : {
1913 : Q_OBJECT
1914 :
1915 : /// Whether a repeat ends on this measureBase
1916 0 : API_PROPERTY_T(bool, repeatEnd, REPEAT_END)
1917 : /// Whether a repeat starts on this measureBase
1918 0 : API_PROPERTY_T(bool, repeatStart, REPEAT_START)
1919 : /// Whether this measureBase contaions a jump.
1920 0 : API_PROPERTY_T(bool, repeatJump, REPEAT_JUMP)
1921 :
1922 : /// \brief Current tick for this measure
1923 : /// \returns Tick of this measure, i.e. number of ticks from the beginning
1924 : /// of the score to this measure, as a fraction.
1925 : /// \see \ref ticklength
1926 : Q_PROPERTY(apiv1::Fraction * tick READ tick)
1927 : /// \brief Length of this measure in ticks.
1928 : /// \returns Length of this measure, i.e. number of ticks from its beginning
1929 : /// to its end, as a fraction.
1930 : /// \see \ref ticklength
1931 : Q_PROPERTY(apiv1::Fraction * ticks READ ticks)
1932 : /// List of measure-related elements: layout breaks, jump/repeat markings etc.
1933 : /// For frames (since MuseScore 4.6), also contains their text elements.
1934 : /// \since MuseScore 3.3
1935 : Q_PROPERTY(QQmlListProperty<apiv1::EngravingItem> elements READ elements)
1936 :
1937 : /// Next measure.
1938 : Q_PROPERTY(apiv1::Measure * nextMeasure READ nextMeasure)
1939 : /// Next measure, accounting for multimeasure rests.
1940 : /// This property may differ from \ref nextMeasure if multimeasure rests
1941 : /// are enabled. If next measure is a multimeasure rest, this property
1942 : /// points to the multimeasure rest measure while \ref nextMeasure in the
1943 : /// same case will point to the first underlying empty measure. Therefore
1944 : /// if visual properties of a measure are needed (as opposed to logical
1945 : /// score structure) this property should be preferred.
1946 : /// \see \ref Score.firstMeasureMM
1947 : /// \since MuseScore 3.6
1948 : Q_PROPERTY(apiv1::Measure * nextMeasureMM READ nextMeasureMM)
1949 :
1950 : /// Previous measure
1951 : Q_PROPERTY(apiv1::Measure * prevMeasure READ prevMeasure)
1952 : /// Previous measure, accounting for multimeasure rests.
1953 : /// See \ref nextMeasureMM for a reference on multimeasure rests.
1954 : /// \see \ref Score.lastMeasureMM
1955 : /// \since MuseScore 3.6
1956 : Q_PROPERTY(apiv1::Measure * prevMeasureMM READ prevMeasureMM)
1957 : /// Next measure or frame.
1958 : /// \since MuseScore 4.6
1959 : Q_PROPERTY(apiv1::MeasureBase * next READ next)
1960 : /// Next measure or frame, accounting for multimeasure rests.
1961 : /// \since MuseScore 4.6
1962 : Q_PROPERTY(apiv1::MeasureBase * nextMM READ nextMM)
1963 : /// Next measure or frame.
1964 : /// \since MuseScore 4.6
1965 : Q_PROPERTY(apiv1::MeasureBase * prev READ prev)
1966 : /// Next measure or frame, accounting for multimeasure rests.
1967 : /// \since MuseScore 4.6
1968 : Q_PROPERTY(apiv1::MeasureBase * prevMM READ prevMM)
1969 :
1970 : public:
1971 : /// \cond MS_INTERNAL
1972 0 : MeasureBase(mu::engraving::MeasureBase* mb = nullptr, Ownership own = Ownership::SCORE)
1973 0 : : EngravingItem(mb, own) {}
1974 :
1975 0 : mu::engraving::MeasureBase* measureBase() { return toMeasureBase(e); }
1976 0 : const mu::engraving::MeasureBase* measureBase() const { return toMeasureBase(e); }
1977 :
1978 : Fraction* tick() const;
1979 : Fraction* ticks() const;
1980 :
1981 0 : Measure* prevMeasure() { return wrap<Measure>(measureBase()->prevMeasure(), Ownership::SCORE); }
1982 0 : Measure* nextMeasure() { return wrap<Measure>(measureBase()->nextMeasure(), Ownership::SCORE); }
1983 0 : Measure* prevMeasureMM() { return wrap<Measure>(measureBase()->prevMeasureMM(), Ownership::SCORE); }
1984 0 : Measure* nextMeasureMM() { return wrap<Measure>(measureBase()->nextMeasureMM(), Ownership::SCORE); }
1985 :
1986 0 : MeasureBase* prev() { return wrap<MeasureBase>(measureBase()->prev(), Ownership::SCORE); }
1987 0 : MeasureBase* next() { return wrap<MeasureBase>(measureBase()->next(), Ownership::SCORE); }
1988 0 : MeasureBase* prevMM() { return wrap<MeasureBase>(measureBase()->prevMM(), Ownership::SCORE); }
1989 0 : MeasureBase* nextMM() { return wrap<MeasureBase>(measureBase()->nextMM(), Ownership::SCORE); }
1990 :
1991 0 : QQmlListProperty<EngravingItem> elements() { return wrapContainerProperty<EngravingItem>(this, measureBase()->el()); }
1992 :
1993 : static void addInternal(mu::engraving::MeasureBase* measureBase, mu::engraving::EngravingItem* el);
1994 : /// \endcond
1995 :
1996 : /// Add to a MeasureBases's elements.
1997 : /// \since MuseScore 4.6
1998 : Q_INVOKABLE void add(apiv1::EngravingItem* wrapped);
1999 : /// Remove a MeasureBase's element.
2000 : /// \since MuseScore 4.6
2001 : Q_INVOKABLE void remove(apiv1::EngravingItem* wrapped);
2002 : };
2003 :
2004 : //---------------------------------------------------------
2005 : // Measure
2006 : // Measure wrapper
2007 : //---------------------------------------------------------
2008 :
2009 : /** APIDOC
2010 : * Class representing a measure.
2011 : * @class Measure
2012 : * @memberof Engraving
2013 : * @hideconstructor
2014 : */
2015 : class Measure : public MeasureBase
2016 : {
2017 : Q_OBJECT
2018 :
2019 : //! NOTE These are properties from MeasureBase, but we'll document them as if they were from Measure.
2020 :
2021 : /** APIDOC
2022 : * Next measure, accounting for multimeasure rests.
2023 : * @readonly
2024 : * @q_property {Engraving.Measure}
2025 : * @name nextMeasureMM
2026 : */
2027 :
2028 : /** APIDOC
2029 : * Previous measure
2030 : * @readonly
2031 : * @q_property {Engraving.Measure}
2032 : * @name prevMeasure
2033 : */
2034 :
2035 : /// The first segment of this measure
2036 : Q_PROPERTY(apiv1::Segment * firstSegment READ firstSegment)
2037 : /// The last segment of this measure
2038 : Q_PROPERTY(apiv1::Segment * lastSegment READ lastSegment)
2039 :
2040 : // Q_PROPERTY(bool lineBreak READ lineBreak WRITE undoSetLineBreak)
2041 : // Q_PROPERTY(bool pageBreak READ pageBreak WRITE undoSetPageBreak)
2042 :
2043 : /// The nominal (written) time signature for this measure.
2044 0 : API_PROPERTY(timesigNominal, TIMESIG_NOMINAL)
2045 : /// The actual time signature / duration of this measure.
2046 0 : API_PROPERTY(timesigActual, TIMESIG_ACTUAL)
2047 :
2048 : /// \brief Measure number, counting from 1.
2049 : /// Number of this measure in the score counting from 1, i.e.
2050 : /// for the first measure its \p measureNumber value will be equal to 1.
2051 : /// User-visible measure number can be calculated as
2052 : /// \code
2053 : /// measure.measureNumber + measure.measureNumberOffset
2054 : /// \endcode
2055 : /// where \p measure is the relevant \ref Measure object.
2056 : /// \since MuseScore 5.0
2057 : /// \see Measure::measureNumberOffset
2058 : Q_PROPERTY(int measureNumber READ measureNumber)
2059 : /// \brief Compatibility alias for \ref measureNumber. Do not use in new code.
2060 : /// \since MuseScore 4.6
2061 : Q_PROPERTY(int no READ measureNumber)
2062 :
2063 : /// \brief The measure number offset of this measure.
2064 : /// \since MuseScore 5.0
2065 0 : API_PROPERTY_T(int, measureNumberOffset, MEASURE_NUMBER_OFFSET)
2066 : /// \brief Compatibility alias for \ref measureNumberOffset. Do not use in new code.
2067 : /// \since MuseScore 4.6
2068 0 : API_PROPERTY_T(int, noOffset, MEASURE_NUMBER_OFFSET)
2069 :
2070 : /// \brief Whether this measure is excluded from measure numbering.
2071 : /// \since MuseScore 5.0
2072 0 : API_PROPERTY_T(bool, excludeFromNumbering, EXCLUDE_FROM_NUMBERING)
2073 : /// \brief Compatibility alias for \ref measureNumberOffset. Do not use in new code.
2074 : /// \since MuseScore 4.6
2075 0 : API_PROPERTY_T(bool, irregular, EXCLUDE_FROM_NUMBERING)
2076 :
2077 : /// Controls whether this measure displays a measure number,
2078 : /// one of PluginAPI::PluginAPI::MeasureNumberMode values.
2079 : /// \since MuseScore 4.6
2080 0 : API_PROPERTY_T(int, measureNumberMode, MEASURE_NUMBER_MODE)
2081 : /// Whether this measure displays a measure number when
2082 : /// \ref measureNumberMode is set to AUTO.
2083 : /// \since MuseScore 4.6
2084 : Q_PROPERTY(bool showsMeasureNumberInAutoMode READ showsMeasureNumberInAutoMode)
2085 :
2086 : /// Whether this measure explicitly breaks a multimeasure rest.
2087 : /// The multimeasure rest may still be broken by measure contents.
2088 0 : API_PROPERTY_T(bool, breakMmr, BREAK_MMR)
2089 : /// For measures before repeats: How many times
2090 : /// the repeat is to be played.
2091 0 : API_PROPERTY_T(int, repeatCount, REPEAT_COUNT)
2092 : /// The spacing ratio for this measure.
2093 0 : API_PROPERTY_T(qreal, userStretch, USER_STRETCH)
2094 :
2095 : /// If this measure is part of a multimeasure rest,
2096 : /// returns the first measure included in it.
2097 : /// \since MuseScore 4.6
2098 : Q_PROPERTY(apiv1::Measure * mmRest READ mmRest)
2099 : /// If this measure is the first measure of a multimeasure rest.
2100 : /// \since MuseScore 4.6
2101 : Q_PROPERTY(bool isMMRestStart READ isMMRest)
2102 :
2103 : /// List of segments in the measure.
2104 : /// \since MuseScore 4.6
2105 : Q_PROPERTY(QQmlListProperty<apiv1::Segment> segments READ segments)
2106 :
2107 : public:
2108 : /// \cond MS_INTERNAL
2109 0 : Measure(mu::engraving::Measure* m = nullptr, Ownership own = Ownership::SCORE)
2110 0 : : MeasureBase(m, own) {}
2111 :
2112 0 : mu::engraving::Measure* measure() { return toMeasure(e); }
2113 0 : const mu::engraving::Measure* measure() const { return toMeasure(e); }
2114 :
2115 0 : int measureNumber() { return measure()->measureNumber(); }
2116 :
2117 0 : bool showsMeasureNumberInAutoMode() { return measure()->showMeasureNumberInAutoMode(); }
2118 :
2119 0 : Segment* firstSegment() { return wrap<Segment>(measure()->firstEnabled(), Ownership::SCORE); }
2120 0 : Segment* lastSegment() { return wrap<Segment>(measure()->last(), Ownership::SCORE); }
2121 :
2122 0 : bool isMMRest() const { return measure()->isMMRest(); }
2123 0 : Measure* mmRest() const { return wrap<Measure>(measure()->mmRest(), Ownership::SCORE); }
2124 :
2125 0 : QQmlListProperty<Segment> segments() { return wrapContainerProperty<Segment>(this, measure()->segments()); }
2126 : /// \endcond
2127 :
2128 : /// Up spacer for a given staff.
2129 : /// \param staffIdx staff to retrieve the spacer from
2130 : /// \since MuseScore 4.6
2131 : Q_INVOKABLE apiv1::EngravingItem* vspacerUp(int staffIdx);
2132 : /// Down spacer for a given staff.
2133 : /// \param staffIdx staff to retrieve the spacer from
2134 : /// \since MuseScore 4.6
2135 : Q_INVOKABLE apiv1::EngravingItem* vspacerDown(int staffIdx);
2136 : /// Measure number object at a given staff.
2137 : /// \param staffIdx staff to retrieve the object from
2138 : /// \since MuseScore 4.6
2139 : Q_INVOKABLE apiv1::EngravingItem* measureNumber(int staffIdx);
2140 : /// The mmRestRange object at a given staff.
2141 : /// \param staffIdx staff to retrieve the object from
2142 : /// \since MuseScore 4.6
2143 : Q_INVOKABLE apiv1::EngravingItem* mmRangeText(int staffIdx);
2144 : /// Whether the measure is corrupted at a given staff.
2145 : /// \param staffIdx staff to check if corrupted
2146 : /// \since MuseScore 4.6
2147 : Q_INVOKABLE bool corrupted(int staffIdx);
2148 : /// Whether the measure is visible at a given staff.
2149 : /// \note This option does not override a staff's visibility
2150 : /// setting, so a measure may not necessarily be visible.
2151 : /// \param staffIdx staff to check if visible
2152 : /// \since MuseScore 4.6
2153 : Q_INVOKABLE bool visible(int staffIdx);
2154 : /// Whether the measure is stemless at a given staff.
2155 : /// \note This option does not override a staff's stemless
2156 : /// setting, so a measure may actually be stemless.
2157 : /// \param staffIdx staff to check if stemless
2158 : /// \since MuseScore 4.6
2159 : Q_INVOKABLE bool stemless(int staffIdx);
2160 : };
2161 :
2162 : //---------------------------------------------------------
2163 : // System
2164 : /// \since MuseScore 4.6
2165 : //---------------------------------------------------------
2166 :
2167 : class System : public EngravingItem
2168 : {
2169 : Q_OBJECT
2170 : /// List of measures and frames in this system.
2171 : Q_PROPERTY(QQmlListProperty<apiv1::MeasureBase> measures READ measures)
2172 : /// The first measure of this system
2173 : Q_PROPERTY(apiv1::Measure * firstMeasure READ firstMeasure)
2174 : /// The last measure of this system
2175 : Q_PROPERTY(apiv1::Measure * lastMeasure READ lastMeasure)
2176 : /// The first measure or frame of this system
2177 : Q_PROPERTY(apiv1::MeasureBase * first READ first)
2178 : /// The last measure or frame of this system
2179 : Q_PROPERTY(apiv1::MeasureBase * last READ last)
2180 : /// Indicates whether this system is locked
2181 : Q_PROPERTY(bool isLocked READ isLocked WRITE setIsLocked)
2182 : /// Indicates whether this system has a page break
2183 : Q_PROPERTY(bool pageBreak READ pageBreak)
2184 : /// The left system divider for this system, if it exists.
2185 : Q_PROPERTY(apiv1::EngravingItem * systemDividerLeft READ systemDividerLeft)
2186 : /// The right system divider for this system, if it exists.
2187 : Q_PROPERTY(apiv1::EngravingItem * systemDividerRight READ systemDividerRight)
2188 :
2189 : public:
2190 : /// \cond MS_INTERNAL
2191 0 : System(mu::engraving::System* sys = nullptr, Ownership own = Ownership::SCORE)
2192 0 : : EngravingItem(sys, own) {}
2193 :
2194 0 : mu::engraving::System* system() { return toSystem(e); }
2195 : const mu::engraving::System* system() const { return toSystem(e); }
2196 :
2197 0 : QQmlListProperty<MeasureBase> measures() { return wrapContainerProperty<MeasureBase>(this, system()->measures()); }
2198 :
2199 0 : Measure* firstMeasure() { return wrap<Measure>(system()->firstMeasure(), Ownership::SCORE); }
2200 0 : Measure* lastMeasure() { return wrap<Measure>(system()->lastMeasure(), Ownership::SCORE); }
2201 0 : MeasureBase* first() { return wrap<MeasureBase>(system()->first(), Ownership::SCORE); }
2202 0 : MeasureBase* last() { return wrap<MeasureBase>(system()->last(), Ownership::SCORE); }
2203 0 : bool isLocked() { return system()->isLocked(); }
2204 : void setIsLocked(bool locked);
2205 0 : bool pageBreak() { return system()->pageBreak(); }
2206 0 : EngravingItem* systemDividerLeft() { return wrap<EngravingItem>(system()->systemDividerLeft(), Ownership::SCORE); }
2207 0 : EngravingItem* systemDividerRight() { return wrap<EngravingItem>(system()->systemDividerRight(), Ownership::SCORE); }
2208 : /// \endcond
2209 :
2210 : /// Bounding box for a given staff.
2211 : /// \param staffIdx staff number
2212 : Q_INVOKABLE QRectF bbox(int staffIdx);
2213 : /// Y position of the bbox relative to the top staff line.
2214 : /// \param staffIdx staff number
2215 : Q_INVOKABLE qreal yOffset(int staffIdx);
2216 : /// Whether the given staff is visible for this system.
2217 : /// This can differ from \ref Staff.show (e.g. due to 'hide when empty' rules).
2218 : /// \param staffIdx staff number
2219 : Q_INVOKABLE bool show(int staffIdx);
2220 : /// Override the staff default behaviour for hiding when empty.
2221 : /// \param staffIdx staff number
2222 : /// \param hide controls the new hiding behaviour.
2223 : /// One of PluginAPI::PluginAPI::AutoOnOff values.
2224 : /// \since MuseScore 4.7
2225 : Q_INVOKABLE void setHideStaffIfEmpty(int staffIdx, int hide);
2226 : };
2227 :
2228 : //---------------------------------------------------------
2229 : // Page
2230 : //---------------------------------------------------------
2231 :
2232 : class Page : public EngravingItem
2233 : {
2234 : Q_OBJECT
2235 :
2236 : /// \brief Page number, counting from 0.
2237 : /// Number of this page in the score counting from 0, i.e.
2238 : /// for the first page its \p pageNumber value will be equal to 0.
2239 : /// User-visible page number can be calculated as
2240 : /// \code
2241 : /// page.pageNumber + 1 + score.pageNumberOffset
2242 : /// \endcode
2243 : /// where \p score is the relevant \ref Score object.
2244 : /// \since MuseScore 4.7
2245 : /// \see Score::pageNumberOffset
2246 : Q_PROPERTY(int pageNumber READ pageNumber)
2247 :
2248 : /// \brief Same as pageNumber, for backward compatibility.
2249 : /// \since MuseScore 3.5
2250 : Q_PROPERTY(int pagenumber READ pageNumber)
2251 :
2252 : /// List of systems on this page.
2253 : /// \since MuseScore 4.6
2254 : Q_PROPERTY(QQmlListProperty<apiv1::System> systems READ systems)
2255 :
2256 : public:
2257 : /// \cond MS_INTERNAL
2258 0 : Page(mu::engraving::Page* p = nullptr, Ownership own = Ownership::SCORE)
2259 0 : : EngravingItem(p, own) {}
2260 :
2261 0 : mu::engraving::Page* page() { return toPage(e); }
2262 0 : const mu::engraving::Page* page() const { return toPage(e); }
2263 :
2264 : int pageNumber() const;
2265 :
2266 0 : QQmlListProperty<System> systems() { return wrapContainerProperty<System>(this, page()->systems()); }
2267 : /// \endcond
2268 : };
2269 :
2270 : //---------------------------------------------------------
2271 : // Ornament
2272 : /// \since MuseScore 4.6
2273 : //---------------------------------------------------------
2274 :
2275 : class Ornament : public EngravingItem
2276 : {
2277 : Q_OBJECT
2278 : /// Whether this ornament has an interval above the attached note.
2279 : Q_PROPERTY(bool hasIntervalAbove READ hasIntervalAbove)
2280 : /// Whether this ornament has an interval below the attached note.
2281 : Q_PROPERTY(bool hasIntervalBelow READ hasIntervalBelow)
2282 : /// Whether this ornament displays a cue note.
2283 : Q_PROPERTY(bool showCueNote READ showCueNote)
2284 : /// The chord containing this ornament's displayed cue note, if one exists.
2285 : /// \since MuseScore 5.0
2286 : Q_PROPERTY(apiv1::Chord * cueNoteChord READ cueNoteChord)
2287 : /// The accidental for the interval above the attached note.
2288 : Q_PROPERTY(apiv1::EngravingItem * accidentalAbove READ accidentalAbove)
2289 : /// The accidental for the interval below the attached note.
2290 : Q_PROPERTY(apiv1::EngravingItem * accidentalBelow READ accidentalBelow)
2291 :
2292 : public:
2293 : /// \cond MS_INTERNAL
2294 0 : Ornament(mu::engraving::Ornament* o = nullptr, Ownership own = Ownership::SCORE)
2295 0 : : EngravingItem(o, own) {}
2296 :
2297 0 : mu::engraving::Ornament* ornament() { return toOrnament(e); }
2298 0 : const mu::engraving::Ornament* ornament() const { return toOrnament(e); }
2299 :
2300 0 : bool hasIntervalAbove() const { return ornament()->hasIntervalAbove(); }
2301 0 : bool hasIntervalBelow() const { return ornament()->hasIntervalBelow(); }
2302 0 : bool showCueNote() { return ornament()->showCueNote(); }
2303 0 : Chord* cueNoteChord() const { return wrap<Chord>(ornament()->cueNoteChord()); }
2304 0 : EngravingItem* accidentalAbove() const { return wrap<EngravingItem>(ornament()->accidentalAbove()); }
2305 0 : EngravingItem* accidentalBelow() const { return wrap<EngravingItem>(ornament()->accidentalBelow()); }
2306 : /// \endcond
2307 : };
2308 :
2309 : //---------------------------------------------------------
2310 : // Staff
2311 : /// \since MuseScore 3.5
2312 : //---------------------------------------------------------
2313 :
2314 : class Staff : public ScoreElement
2315 : {
2316 : Q_OBJECT
2317 :
2318 0 : API_PROPERTY_T(bool, small, SMALL)
2319 0 : API_PROPERTY_T(qreal, mag, MAG)
2320 : /// Staff color. See https://doc.qt.io/qt-5/qml-color.html
2321 : /// for the reference on color type in QML.
2322 0 : API_PROPERTY_T(QColor, color, STAFF_COLOR)
2323 :
2324 : /// Whether voice 1 participates in playback.
2325 0 : API_PROPERTY_T(bool, playbackVoice1, PLAYBACK_VOICE1)
2326 : /// Whether voice 2 participates in playback.
2327 0 : API_PROPERTY_T(bool, playbackVoice2, PLAYBACK_VOICE2)
2328 : /// Whether voice 3 participates in playback.
2329 0 : API_PROPERTY_T(bool, playbackVoice3, PLAYBACK_VOICE3)
2330 : /// Whether voice 4 participates in playback.
2331 0 : API_PROPERTY_T(bool, playbackVoice4, PLAYBACK_VOICE4)
2332 :
2333 : /// Whether a staff should display measure numbers.
2334 : /// One of PluginAPI::PluginAPI::AutoOnOff values.
2335 : /// \since MuseScore 4.6
2336 0 : API_PROPERTY(showMeasureNumbers, SHOW_MEASURE_NUMBERS)
2337 :
2338 : /// Whether to show this staff if the entire system is empty.
2339 : /// \since MuseScore 4.6
2340 0 : API_PROPERTY_T(bool, showIfEntireSystemEmpty, SHOW_IF_ENTIRE_SYSTEM_EMPTY)
2341 :
2342 0 : API_PROPERTY_T(int, staffBarlineSpan, STAFF_BARLINE_SPAN)
2343 0 : API_PROPERTY_T(int, staffBarlineSpanFrom, STAFF_BARLINE_SPAN_FROM)
2344 0 : API_PROPERTY_T(int, staffBarlineSpanTo, STAFF_BARLINE_SPAN_TO)
2345 :
2346 : /// Controls whether the staff lines are visible.
2347 : ///\since MuseScore 4.6
2348 0 : API_PROPERTY_T(bool, staffInvisible, STAFF_INVISIBLE)
2349 :
2350 : /// User-defined amount of additional space before this staff.
2351 : /// It is recommended to consider adding a spacer instead as it
2352 : /// allows adjusting staff spacing locally as opposed to this
2353 : /// property.
2354 : /// \see \ref EngravingItem.space
2355 0 : API_PROPERTY_T(qreal, staffUserdist, STAFF_USERDIST)
2356 :
2357 : /// Part which this staff belongs to.
2358 : Q_PROPERTY(apiv1::Part * part READ part);
2359 :
2360 : /// The index of this staff.
2361 : /// \since MuseScore 4.6
2362 : Q_PROPERTY(int idx READ idx)
2363 :
2364 : /// Whether the staff is visible (combines part and staff visibility, read-only).
2365 : /// \since MuseScore 4.6
2366 : Q_PROPERTY(bool show READ show)
2367 :
2368 : /// Whether the staff itself is visible.
2369 : /// \since MuseScore 4.6
2370 2 : API_PROPERTY_T(bool, visible, VISIBLE)
2371 : /// Whether this is a cutaway staff, which hides itself
2372 : /// mid-system when measures are empty.
2373 : /// \since MuseScore 4.6
2374 2 : API_PROPERTY_T(bool, cutaway, STAFF_CUTAWAY)
2375 : /// Whether to display the system barline (leftmost barline).
2376 : /// \since MuseScore 4.6
2377 2 : API_PROPERTY_T(bool, hideSystemBarLine, STAFF_HIDE_SYSTEM_BARLINE)
2378 : /// Whether to merge matching rests across voices.
2379 : /// One of PluginAPI::PluginAPI::AutoOnOff values.
2380 : /// If Auto, determined by the global style setting \p mergeMatchingRests .
2381 : /// \since MuseScore 4.6
2382 2 : API_PROPERTY(mergeMatchingRests, STAFF_MERGE_MATCHING_RESTS)
2383 : /// Whether to reflect transposition in the linked tablature staff.
2384 : /// \since MuseScore 4.6
2385 2 : API_PROPERTY_T(bool, reflectTranspositionInLinkedTab, STAFF_REFLECT_TRANSPOSITION)
2386 : /// The primary (not linked) staff of this staff.
2387 : /// \since MuseScore 4.6
2388 : Q_PROPERTY(apiv1::Staff * primaryStaff READ primaryStaff)
2389 :
2390 : public:
2391 : /// \cond MS_INTERNAL
2392 6 : Staff(mu::engraving::Staff* staff, Ownership own = Ownership::PLUGIN)
2393 6 : : apiv1::ScoreElement(staff, own) {}
2394 :
2395 3 : mu::engraving::Staff* staff() { return toStaff(e); }
2396 : const mu::engraving::Staff* staff() const { return toStaff(e); }
2397 :
2398 : Part* part();
2399 0 : int idx() { return int(staff()->idx()); }
2400 0 : bool show() { return staff()->show(); }
2401 0 : Staff* primaryStaff() { return wrap<Staff>(staff()->primaryStaff()); }
2402 : /// \endcond
2403 :
2404 : /// The current clef type at a given tick in the score, one of
2405 : /// PluginAPI::PluginAPI::ClefType values.
2406 : /// \param tick Tick location in the score, as a fraction.
2407 : /// \see PluginAPI::PluginAPI::ClefType
2408 : /// \since MuseScore 4.6
2409 : Q_INVOKABLE int clefType(apiv1::Fraction* tick);
2410 : /// The current timestretch factor at a given tick in the score, i.e. the
2411 : /// ratio of the local time signature over the global time signature.
2412 : /// \param tick Tick location in the score, as a fraction.
2413 : /// \since MuseScore 4.6
2414 : Q_INVOKABLE apiv1::Fraction* timeStretch(apiv1::Fraction* tick);
2415 : /// The currently active time signature at a given tick in the score.
2416 : /// \param tick Tick location in the score, as a fraction.
2417 : /// \since MuseScore 4.6
2418 : Q_INVOKABLE EngravingItem* timeSig(apiv1::Fraction* tick);
2419 : /// The current written key at a given tick in the score, one of
2420 : /// PluginAPI::PluginAPI::Key values.
2421 : /// \param tick Tick location in the score, as a fraction.
2422 : /// \see PluginAPI::PluginAPI::Key
2423 : /// \since MuseScore 4.6
2424 : Q_INVOKABLE int key(apiv1::Fraction* tick);
2425 : /// The transposition at a given tick in the score, active if the
2426 : /// score is not in concert pitch.
2427 : /// \param tick Tick location in the score, as a fraction.
2428 : /// \see PluginAPI::IntervalWrapper
2429 : /// \since MuseScore 4.6
2430 : Q_INVOKABLE apiv1::IntervalWrapper* transpose(apiv1::Fraction* tick);
2431 :
2432 : /// The swing settings at a given tick.
2433 : /// \returns An object with the following fields:
2434 : /// - \p swingUnit - raw tick length value of the swing unit
2435 : /// - \p swingRatio - value of the ratio, percentage.
2436 : /// - \p isOn - whether swing is active.
2437 : /// \param tick Tick location in the score, as a fraction.
2438 : /// \since MuseScore 4.6
2439 : Q_INVOKABLE QVariantMap swing(apiv1::Fraction* tick);
2440 : /// The capo settings at a given tick.
2441 : /// \returns An object with the following fields:
2442 : /// - \p active - whether there is a capo active.
2443 : /// - \p fretPosition - the fret of the capo
2444 : /// - \p ignoredStrings - list of strings not affected by the capo.
2445 : /// \param tick Tick location in the score, as a fraction.
2446 : /// \since MuseScore 4.6
2447 : Q_INVOKABLE QVariantMap capo(apiv1::Fraction* tick);
2448 :
2449 : /// Whether the notes at a given tick are stemless
2450 : /// \param tick Tick location in the score, as a fraction.
2451 : /// \since MuseScore 4.6
2452 : Q_INVOKABLE bool stemless(apiv1::Fraction* tick);
2453 : /// The staff height at a given tick in spatium units.
2454 : /// \param tick Tick location in the score, as a fraction.
2455 : /// \since MuseScore 4.6
2456 : Q_INVOKABLE qreal staffHeight(apiv1::Fraction* tick);
2457 : // StaffType helper functions
2458 : /// Whether the staff is a pitched staff at a given tick.
2459 : /// \param tick Tick location in the score, as a fraction.
2460 : /// \since MuseScore 4.6
2461 : Q_INVOKABLE bool isPitchedStaff(apiv1::Fraction* tick);
2462 : /// Whether the staff is a tab staff at a given tick.
2463 : /// \param tick Tick location in the score, as a fraction.
2464 : /// \since MuseScore 4.6
2465 : Q_INVOKABLE bool isTabStaff(apiv1::Fraction* tick);
2466 : /// Whether the staff is a drum staff at a given tick.
2467 : /// \param tick Tick location in the score, as a fraction.
2468 : /// \since MuseScore 4.6
2469 : Q_INVOKABLE bool isDrumStaff(apiv1::Fraction* tick);
2470 : /// The number of staff lines at a given tick.
2471 : /// \param tick Tick location in the score, as a fraction.
2472 : /// \since MuseScore 4.6
2473 : Q_INVOKABLE int lines(apiv1::Fraction* tick);
2474 : /// The distance between staff lines at a given tick, in spatium units.
2475 : /// \param tick Tick location in the score, as a fraction.
2476 : /// \since MuseScore 4.6
2477 : Q_INVOKABLE qreal lineDistance(apiv1::Fraction* tick);
2478 : /// Whether the staff lines are invisible at a given tick.
2479 : /// \param tick Tick location in the score, as a fraction.
2480 : /// \since MuseScore 4.6
2481 : Q_INVOKABLE bool isLinesInvisible(apiv1::Fraction* tick);
2482 : /// The middle line of this staff at a given tick.
2483 : /// \param tick Tick location in the score, as a fraction.
2484 : /// \since MuseScore 4.6
2485 : Q_INVOKABLE int middleLine(apiv1::Fraction* tick);
2486 : /// The bottom line of this staff at a given tick.
2487 : /// \param tick Tick location in the score, as a fraction.
2488 : /// \since MuseScore 4.6
2489 : Q_INVOKABLE int bottomLine(apiv1::Fraction* tick);
2490 : /// The staff scaling at a given tick.
2491 : /// \param tick Tick location in the score, as a fraction.
2492 : /// \since MuseScore 4.6
2493 : Q_INVOKABLE qreal staffMag(apiv1::Fraction* tick);
2494 : /// The spatium value at a given tick.
2495 : /// \param tick Tick location in the score, as a fraction.
2496 : /// \since MuseScore 4.6
2497 : Q_INVOKABLE qreal spatium(apiv1::Fraction* tick);
2498 : /// The pitch offset value at a given tick, determined by active ottavas.
2499 : /// \param tick Tick location in the score, as a fraction.
2500 : /// \since MuseScore 4.6
2501 : Q_INVOKABLE int pitchOffset(apiv1::Fraction* tick);
2502 :
2503 : /// For staves in part scores: Whether the given voice
2504 : /// is displayed in the score.
2505 : /// \param voice The voice number (0-3) to check.
2506 : /// \since MuseScore 4.6
2507 : Q_INVOKABLE bool isVoiceVisible(int voice);
2508 : };
2509 :
2510 : //---------------------------------------------------------
2511 : // SpannerSegment
2512 : /// Provides access to internal mu::engraving::SpannerSegment objects.
2513 : /// \since MuseScore 4.6
2514 : //---------------------------------------------------------
2515 :
2516 : class SpannerSegment : public EngravingItem
2517 : {
2518 : Q_OBJECT
2519 : /// The spanner object of this spanner segment.
2520 : /// \see PluginAPI::Spanner
2521 : Q_PROPERTY(apiv1::Spanner * spanner READ spanner)
2522 : /// The spanner segment type of this spanner segment,
2523 : /// one of PluginAPI::PluginAPI::SpannerSegmentType values.
2524 : Q_PROPERTY(int spannerSegmentType READ spannerSegmentType)
2525 : /// Position of the spanner segment's end part,
2526 : /// including manual offset through \ref userOff2.
2527 : /// \see EngravingItem::userOff2
2528 : Q_PROPERTY(QPointF pos2 READ pos2)
2529 : /// For line segments:
2530 : /// The manual offset of the spanner segment's end part.
2531 0 : API_PROPERTY_T(QPointF, userOff2, OFFSET2)
2532 : /// For slur and tie segments:
2533 : /// The manual offset applied to the first point.
2534 0 : API_PROPERTY_T(QPointF, slurUoff1, BEZIER_OFFSET1)
2535 : /// For slur and tie segments:
2536 : /// The manual offset applied to the second point.
2537 0 : API_PROPERTY_T(QPointF, slurUoff2, BEZIER_OFFSET2)
2538 : /// For slur and tie segments:
2539 : /// The manual offset applied to the third point.
2540 0 : API_PROPERTY_T(QPointF, slurUoff3, BEZIER_OFFSET3)
2541 : /// For slur and tie segments:
2542 : /// The manual offset applied to the fourth point.
2543 0 : API_PROPERTY_T(QPointF, slurUoff4, BEZIER_OFFSET4)
2544 :
2545 : /// \cond MS_INTERNAL
2546 :
2547 : public:
2548 0 : SpannerSegment(mu::engraving::SpannerSegment* spannerSegment, Ownership own = Ownership::PLUGIN)
2549 0 : : EngravingItem(spannerSegment, own) {}
2550 :
2551 0 : mu::engraving::SpannerSegment* spannerSegment() { return toSpannerSegment(e); }
2552 0 : const mu::engraving::SpannerSegment* spannerSegment() const { return toSpannerSegment(e); }
2553 :
2554 0 : Spanner* spanner() { return wrap<Spanner>(spannerSegment()->spanner()); }
2555 0 : int spannerSegmentType() { return int(spannerSegment()->spannerSegmentType()); }
2556 0 : QPointF pos2() const { return PointF(spannerSegment()->pos2() / spannerSegment()->spatium()).toQPointF(); }
2557 :
2558 : /// \endcond
2559 : };
2560 :
2561 : /** APIDOC
2562 : * Provides access to internal mu::engraving::Spanner objects.
2563 : * @class Spanner
2564 : * @memberof Engraving
2565 : * @hideconstructor
2566 : * @since 4.6
2567 : */
2568 : class Spanner : public EngravingItem
2569 : {
2570 : Q_OBJECT
2571 : /// The tick this spanner starts at.
2572 0 : API_PROPERTY(spannerTick, SPANNER_TICK)
2573 : /// The duration of this spanner.
2574 0 : API_PROPERTY(spannerTicks, SPANNER_TICKS)
2575 : /// The track this spanner end at.
2576 0 : API_PROPERTY_T(int, spannerTrack2, SPANNER_TRACK2)
2577 :
2578 : /// The starting element of the spanner.
2579 : Q_PROPERTY(apiv1::EngravingItem * startElement READ startElement)
2580 : /// The ending element of the spanner.
2581 : Q_PROPERTY(apiv1::EngravingItem * endElement READ endElement)
2582 : /// List of spanner segments belonging to this spanner.
2583 : Q_PROPERTY(QQmlListProperty<apiv1::SpannerSegment> spannerSegments READ spannerSegments)
2584 : /// The ornament object of this spanner
2585 : Q_PROPERTY(apiv1::Ornament * ornament READ ornament)
2586 : /// \cond MS_INTERNAL
2587 :
2588 : public:
2589 0 : Spanner(mu::engraving::Spanner* spanner, Ownership own = Ownership::PLUGIN)
2590 0 : : EngravingItem(spanner, own) {}
2591 :
2592 0 : mu::engraving::Spanner* spanner() { return toSpanner(e); }
2593 0 : const mu::engraving::Spanner* spanner() const { return toSpanner(e); }
2594 :
2595 0 : EngravingItem* startElement() const { return wrap(spanner()->startElement()); }
2596 0 : EngravingItem* endElement() const { return wrap(spanner()->endElement()); }
2597 :
2598 0 : QQmlListProperty<SpannerSegment> spannerSegments()
2599 : {
2600 0 : return wrapContainerProperty<SpannerSegment>(this, spanner()->spannerSegments());
2601 : }
2602 :
2603 : Ornament* ornament() const;
2604 :
2605 : /// \endcond
2606 : };
2607 :
2608 : //---------------------------------------------------------
2609 : // Tie
2610 : /// Provides access to internal mu::engraving::Tie objects.
2611 : /// \since MuseScore 3.3
2612 : //---------------------------------------------------------
2613 :
2614 : class Tie : public Spanner
2615 : {
2616 : Q_OBJECT
2617 : /// The starting note of the tie.
2618 : Q_PROPERTY(apiv1::Note * startNote READ startNote)
2619 : /// The ending note of the tie.
2620 : Q_PROPERTY(apiv1::Note * endNote READ endNote)
2621 : /// Whether the placement is inside.
2622 : /// \since MuseScore 4.6
2623 : Q_PROPERTY(bool isInside READ isInside)
2624 :
2625 : /// \cond MS_INTERNAL
2626 :
2627 : public:
2628 0 : Tie(mu::engraving::Tie* tie, Ownership own = Ownership::PLUGIN)
2629 0 : : Spanner(tie, own) {}
2630 :
2631 : mu::engraving::Tie* tie() { return toTie(e); }
2632 0 : const mu::engraving::Tie* tie() const { return toTie(e); }
2633 :
2634 0 : Note* startNote() const { return wrap<Note>(tie()->startNote()); }
2635 0 : Note* endNote() const { return wrap<Note>(tie()->endNote()); }
2636 0 : bool isInside() const { return tie()->isInside(); }
2637 :
2638 : /// \endcond
2639 : };
2640 :
2641 : /** APIDOC
2642 : * Class representing a lyric.
2643 : * @class Lyrics
2644 : * @memberof Engraving
2645 : * @hideconstructor
2646 : * @since 4.7
2647 : */
2648 : class Lyrics : public EngravingItem
2649 : {
2650 : Q_OBJECT
2651 : Q_PROPERTY(QString plainText READ plainText)
2652 : Q_PROPERTY(bool isMelisma READ isMelisma)
2653 : Q_PROPERTY(apiv1::EngravingItem * separator READ separator)
2654 :
2655 : /// The syllabic property determines hyphenation for lyrics.
2656 : /// One of PluginAPI::PluginAPI::Syllabic values.
2657 0 : API_PROPERTY_T(int, syllabic, SYLLABIC)
2658 : /// The tick length of a lyrics object.
2659 0 : API_PROPERTY(lyricTicks, LYRIC_TICKS)
2660 :
2661 : public:
2662 :
2663 0 : Lyrics(mu::engraving::Lyrics* l = nullptr, Ownership own = Ownership::PLUGIN)
2664 0 : : EngravingItem(l, own) {}
2665 :
2666 : mu::engraving::Lyrics* lyrics() { return toLyrics(e); }
2667 0 : const mu::engraving::Lyrics* lyrics() const { return toLyrics(e); }
2668 :
2669 : /** APIDOC @property {string} - plain text of lyric, i.e. text with formatting removed */
2670 0 : QString plainText() const { return lyrics()->plainText(); }
2671 : /** APIDOC @property {bool} - whether this lyric is a melisma */
2672 0 : bool isMelisma() const { return lyrics()->isMelisma(); }
2673 : /** APIDOC @property {EngravingItem} - the lyrics line for this lyric, if it exists */
2674 0 : apiv1::EngravingItem* separator() const { return wrap(lyrics()->separator()); }
2675 : };
2676 :
2677 : //---------------------------------------------------------
2678 : // Harmony
2679 : //---------------------------------------------------------
2680 :
2681 : /** APIDOC
2682 : * Class representing a chord symbol (Harmony).
2683 : * @class Harmony
2684 : * @memberof Engraving
2685 : * @hideconstructor
2686 : * @since 4.7
2687 : */
2688 : class Harmony : public EngravingItem
2689 : {
2690 : Q_OBJECT
2691 : /// Plain text representation of the chord symbol (no formatting).
2692 : Q_PROPERTY(QString plainText READ plainText)
2693 : /// Display text of the chord symbol (with formatting).
2694 : Q_PROPERTY(QString displayText READ displayText)
2695 : /// Internal harmony name used for chord matching against the diagram database.
2696 : Q_PROPERTY(QString harmonyName READ harmonyName)
2697 :
2698 : public:
2699 : /// \cond MS_INTERNAL
2700 2 : Harmony(mu::engraving::Harmony* h = nullptr, Ownership own = Ownership::PLUGIN)
2701 2 : : EngravingItem(h, own) {}
2702 :
2703 : mu::engraving::Harmony* harmony() { return toHarmony(e); }
2704 4 : const mu::engraving::Harmony* harmony() const { return toHarmony(e); }
2705 :
2706 2 : QString plainText() const { return harmony()->plainText(); }
2707 1 : QString displayText() const { return harmony()->displayText().toQString(); }
2708 1 : QString harmonyName() const { return harmony()->harmonyName().toQString(); }
2709 : /// \endcond
2710 : };
2711 :
2712 : //---------------------------------------------------------
2713 : // FretDiagram
2714 : //---------------------------------------------------------
2715 :
2716 : /** APIDOC
2717 : * Class representing a fretboard diagram. The chord symbol that this diagram is
2718 : * associated with (when present) is nested inside it and can be reached via the
2719 : * `harmony` property.
2720 : * @class FretDiagram
2721 : * @memberof Engraving
2722 : * @hideconstructor
2723 : * @since 4.7
2724 : */
2725 : class FretDiagram : public EngravingItem
2726 : {
2727 : Q_OBJECT
2728 : /// The chord symbol nested inside this fretboard diagram, or null if none.
2729 : Q_PROPERTY(apiv1::Harmony * harmony READ harmony)
2730 : /// Plain text of the nested chord symbol, or an empty string if none.
2731 : Q_PROPERTY(QString harmonyPlainText READ harmonyPlainText)
2732 : /// Display text of the nested chord symbol, or an empty string if none.
2733 : Q_PROPERTY(QString harmonyDisplayText READ harmonyDisplayText)
2734 : /// Number of strings in this diagram.
2735 : Q_PROPERTY(int strings READ strings)
2736 : /// Number of frets displayed in this diagram.
2737 : Q_PROPERTY(int frets READ frets)
2738 : // fretOffset comes writable from EngravingItem; redeclaring it here would make it read-only
2739 :
2740 : public:
2741 : /// \cond MS_INTERNAL
2742 7 : FretDiagram(mu::engraving::FretDiagram* fd = nullptr, Ownership own = Ownership::PLUGIN)
2743 7 : : EngravingItem(fd, own) {}
2744 :
2745 17 : mu::engraving::FretDiagram* fretDiagram() { return toFretDiagram(e); }
2746 8 : const mu::engraving::FretDiagram* fretDiagram() const { return toFretDiagram(e); }
2747 :
2748 1 : apiv1::Harmony* harmony() const
2749 : {
2750 1 : return wrap<apiv1::Harmony>(fretDiagram()->harmony(), Ownership::SCORE);
2751 : }
2752 :
2753 1 : QString harmonyPlainText() const { return fretDiagram()->harmonyPlainText().toQString(); }
2754 1 : QString harmonyDisplayText() const { return fretDiagram()->harmonyDisplayText().toQString(); }
2755 :
2756 1 : int strings() const { return fretDiagram()->strings(); }
2757 1 : int frets() const { return fretDiagram()->frets(); }
2758 : /// \endcond
2759 :
2760 : /** APIDOC
2761 : * Return all dots currently placed on this diagram as a list of objects,
2762 : * each with `string` (0-based), `fret` (1-based), and `dotType`
2763 : * (one of PluginAPI::PluginAPI::FretDotType values).
2764 : * @method
2765 : * @returns {Array.<{string: Number, fret: Number, dotType: Number}>}
2766 : * @since 4.7
2767 : */
2768 : Q_INVOKABLE QVariantList dots() const;
2769 :
2770 : /** APIDOC
2771 : * Return all string markers on this diagram as a list of objects,
2772 : * each with `string` (0-based) and `markerType`
2773 : * (one of PluginAPI::PluginAPI::FretMarkerType values).
2774 : * Only strings with an active marker (open or muted) are included.
2775 : * @method
2776 : * @returns {Array.<{string: Number, markerType: Number}>}
2777 : * @since 4.7
2778 : */
2779 : Q_INVOKABLE QVariantList markers() const;
2780 :
2781 : /** APIDOC
2782 : * Return all barres on this diagram as a list of objects,
2783 : * each with `fret` (1-based), `startString` and `endString` (0-based).
2784 : * @method
2785 : * @returns {Array.<{fret: Number, startString: Number, endString: Number}>}
2786 : * @since 4.7
2787 : */
2788 : Q_INVOKABLE QVariantList barres() const;
2789 :
2790 : /** APIDOC
2791 : * Place or remove a dot at the given fret on the given string. The change is
2792 : * undoable and propagates to all linked clones of the diagram.
2793 : * @method
2794 : * @param {Number} string 0-based string index (0 is the lowest pitched string).
2795 : * @param {Number} fret fret number (1-based, relative to fretOffset).
2796 : * Pass 0 to clear the dots on that string.
2797 : * @param {Boolean} add If true, append to existing dots instead of replacing.
2798 : * @param {Number} dotType One of PluginAPI::PluginAPI::FretDotType values.
2799 : * @since 4.7
2800 : */
2801 : Q_INVOKABLE void setDot(int string, int fret, bool add = false, int dotType = int(mu::engraving::FretDotType::NORMAL));
2802 :
2803 : /** APIDOC
2804 : * Set the marker for a string (open circle / muted X / none). Undoable and
2805 : * propagates to all linked clones.
2806 : * @method
2807 : * @param {Number} string 0-based string index.
2808 : * @param {Number} marker One of PluginAPI::PluginAPI::FretMarkerType values.
2809 : * @since 4.7
2810 : */
2811 : Q_INVOKABLE void setMarker(int string, int marker);
2812 :
2813 : /** APIDOC
2814 : * Add a barre at the given fret extending up to the given string. Undoable and
2815 : * propagates to all linked clones.
2816 : * @method
2817 : * @param {Number} string 0-based last string covered by the barre.
2818 : * @param {Number} fret fret number (1-based, relative to fretOffset).
2819 : * @param {Boolean} add If true, append to existing barres at that fret.
2820 : * @since 4.7
2821 : */
2822 : Q_INVOKABLE void setBarre(int string, int fret, bool add = false);
2823 :
2824 : /** APIDOC
2825 : * Clear all dots, markers, and barres from this diagram. Undoable and
2826 : * propagates to all linked clones.
2827 : * @method
2828 : * @since 4.7
2829 : */
2830 : Q_INVOKABLE void clear();
2831 : };
2832 :
2833 : #undef API_PROPERTY
2834 : #undef API_PROPERTY_T
2835 : #undef API_PROPERTY_READ_ONLY
2836 : #undef API_PROPERTY_READ_ONLY_T
2837 : }
|