MuseScore Plugins  3.2.3
Plugins API for MuseScore
Public Types | Public Member Functions | Properties | List of all members
Cursor Class Reference

Cursor can be used by plugins to manipulate the score. More...

Inheritance diagram for Cursor:
Inheritance graph
[legend]
Collaboration diagram for Cursor:
Collaboration graph
[legend]

Public Types

enum  RewindMode { SCORE_START = 0, SELECTION_START = 1, SELECTION_END = 2 }
 

Public Member Functions

Q_INVOKABLE void rewind (RewindMode mode)
 Rewind cursor to a certain position. More...
 
Q_INVOKABLE bool next ()
 Move the cursor to the next segment. More...
 
Q_INVOKABLE bool nextMeasure ()
 Move the cursor to the first segment of the next measure. More...
 
Q_INVOKABLE void add (Ms::PluginAPI::Element *)
 Adds the given element to a score at this cursor's position.
 
Q_INVOKABLE void addNote (int pitch)
 Adds a note to the current cursor position. More...
 
Q_INVOKABLE void setDuration (int z, int n)
 Set duration of the notes added by the cursor. More...
 

Properties

int track
 Current track.
 
int staffIdx
 Current staff (track / 4)
 
int voice
 Current voice (track % 4)
 
int filter
 Segment type filter, a bitmask from PluginAPI::PluginAPI::Segment values. More...
 
int tick
 MIDI tick position, read only.
 
double time
 Time at tick position, read only.
 
qreal tempo
 Tempo at current tick, read only.
 
int keySignature
 Key signature of current staff at tick pos. More...
 
Ms::PluginAPI::Score score
 Associated score.
 
Ms::PluginAPI::Element element
 Current element at track, read only.
 
Ms::PluginAPI::Segment segment
 Current segment, read only.
 
Ms::PluginAPI::Measure measure
 Current measure, read only.
 

Detailed Description

Cursor can be used by plugins to manipulate the score.

Member Enumeration Documentation

◆ RewindMode

enum RewindMode
Enumerator
SCORE_START 

Rewind to the start of a score.

SELECTION_START 

Rewind to the start of a selection.

SELECTION_END 

Rewind to the end of a selection.

Member Function Documentation

◆ addNote()

void addNote ( int  pitch)

Adds a note to the current cursor position.

The duration of the added note equals to what has been set by the previous setDuration() call.

Parameters
pitchMIDI pitch of the added note.

◆ next()

bool next ( )

Move the cursor to the next segment.

Returns
false if the end of the score is reached, true otherwise.

◆ nextMeasure()

bool nextMeasure ( )

Move the cursor to the first segment of the next measure.

Returns
false if the end of the score is reached, true otherwise.

◆ rewind()

void rewind ( RewindMode  mode)

Rewind cursor to a certain position.

Parameters
modeDetermines the position where to move this cursor. See Cursor::RewindMode to see the list of avaliable rewind modes.
Note
In MuseScore 2.X, this function took an integer value (0, 1 or 2) as its parameter. For compatibility reasons, the old values are still working, but it is recommended to use RewindMode enumerators instead.

◆ setDuration()

void setDuration ( int  z,
int  n 
)

Set duration of the notes added by the cursor.

Parameters
znumerator
ndenominator. If n == 0, sets duration to a quarter.
See also
addNote()

Property Documentation

◆ filter

int filter
readwrite

Segment type filter, a bitmask from PluginAPI::PluginAPI::Segment values.

Determines which segments this cursor will move to on next() and nextMeasure() operations. The default value is Ms::SegmentType::ChordRest so only segments containing chords and rests are handled by default.

◆ keySignature

int keySignature
read

Key signature of current staff at tick pos.

(read only)


The documentation for this class was generated from the following files: