Offset/pos values of slurs always return 0?

• Dec 4, 2024 - 20:20

In my tests so far, I’ve found that slur.offsetX, slur.offsetY, slur.posX and slur.posY all return 0, regardless of what the 'Offset' values in the Properties pane read. (I've checked that my variable slur contains a valid slur object).
Anyone know how to get the offset measurements of a slur?


Comments

I think you are looking for these properties: slurUoff1, slurUoff2, slurUoff3, slurUoff4, which contain a QPoint value (e.g. slurUoff1.x, slurUoff1.y) that refers to changing the individual 'handles' of a slur; offsetX and offsetY concern the 'overall' displacement of a slur.

In reply to by michaelnorris

The explanation could be this: if you select the score with the 'blue rectangle' the slurs are identified as a 'Tie' element (number 28) and do not allow access (not even read) to the offset/pos properties (or rather they do not detect them). Access is only possible (read/write) with individual selections (the item found is 'Tie_Segment'). I'm just guessing... It's up to you to say if that's the problem.

In reply to by ILPEPITO

Just circling back to this, as it still doesn't seem to be working.
I have a slur now, which is valid (spannerTick.ticks and spannerTicks.ticks return the start and end tick of the slur). But asking for slur.slurUoff1, slur.slurUoff2, slur.slurUoff3 and slur.slurUoff4 always return 'undefined', even where the handle is definitely offset.

Here's the code:

currentSlur = slurs[currentStaffNum][currentSlurNum]; // previously saved from blue selection.elements
currentSlurEnd = currentSlur.spannerTick.ticks + currentSlur.spannerTicks.ticks;
logError("Slur started at "+currTick+" & ends at "+currentSlurEnd); // WORKS CORRECTLY
var off1 = currentSlur.slurUoff1 == undefined ? 0 : currentSlur.slurUoff1.x;
var off2 = currentSlur.slurUoff2 == undefined ? 0 : currentSlur.slurUoff2.x;
var off3 = currentSlur.slurUoff3 == undefined ? 0 : currentSlur.slurUoff3.x;
var off4 = currentSlur.slurUoff4 == undefined ? 0 : currentSlur.slurUoff4.x;
logError("Slur offs: "+currentSlur.posX+" "+currentSlur.offsetX+" "+off1+" "+off2+" "+off3+" "+off4); // ALWAYS RETURNS 0 0 0 0 0 0

Do you still have an unanswered question? Please log in first to post your question.