Skip to content

Conversation

@Reedbeta
Copy link
Contributor

@Reedbeta Reedbeta commented Dec 2, 2025

Resolves: #16911
Resolves: #25070
Resolves: #31359

Support copy/paste in local time signatures, with the restriction that the source and destination ranges must all have the same time stretch ratio. Also enables features like "repeat selection", Alt+drag range copies, and explode which are built on copy/paste internally.

Tested:

  • Tuplets
  • Dynamics etc.
  • Spanners/lines
  • Multiple voices
  • Multiple staves
  • Explode/implode
  • Paste double/half duration
  • Working on the measure before a local time sig change
  • The measure after a local time sig change
  • The last measure

Some other minor changes in this PR:

  • Adds a natvis file for the Visual Studio debugger with visualizers for a few common types such as Fraction.
  • Fixes a handful of debug-only asserts that I ran into.
  • Use the "forbidden" cursor (🚫) when Alt+dragging to a location that you can't drop in (either because of local time signatures or another reason).
  • Setup time ticks properly for local time signatures (so Alt+drag will work).
  • Show error dialogs for explode/implode and repeat-selection when we can't do it due to local time signatures.
  • I signed the CLA
  • The title of the PR describes the problem it addresses
  • Each commit's message describes its purpose and effects, and references the issue it resolves
  • If changes are extensive, there is a sequence of easily reviewable commits
  • The code in the PR follows the coding rules
  • There are no unnecessary changes
  • The code compiles and runs on my machine, preferably after each commit individually
  • I created a unit test or vtest to verify the changes I made (if applicable)

@Reedbeta Reedbeta force-pushed the pr/paste-local-time-sig branch from c60d633 to ee7c790 Compare December 6, 2025 07:38
@Reedbeta Reedbeta marked this pull request as ready for review December 8, 2025 04:25
Copy link
Member

@cbjeukendrup cbjeukendrup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks very much for this comprehensive PR!


const bool canDrop = viewInteraction()->updateDropRange(ctx.logicClickPos);
m_view->asItem()->setCursor(canDrop ? Qt::DragCopyCursor : QCursor());
m_view->asItem()->setCursor(canDrop ? Qt::DragCopyCursor : Qt::ForbiddenCursor);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that the designers are not super fond of the "forbidden" cursor, so we might need to distinguish between "can't drop because you're not hovering any destination location" (which would show the default cursor) or "can't drop because there's something wrong with the hovered destination location" (which would show the "forbidden" cursor). But let's await testing.

(@avvvvve fyi)

Comment on lines +90 to +95
TimeSig* timeSig = measure->score()->staff(staffIdx)->timeSig(measure->tick());
Fraction timeSigFrac = timeSig ? timeSig->sig() : measure->timesig();
Fraction halfDivision = Fraction(1, 2 * timeSigFrac.denominator());
if (timeSig) {
halfDivision /= timeSig->stretch();
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One issue with this is that once the time ticks are populated, we see the union of the time ticks for all the different local time signatures, even though many of them are unusable as drop targets in one time signature or the other.

It would be nicer if we had a way to filter which time ticks are visible when drag-dropping, but I'm not sure how best to accomplish that.

@zacjansheski
Copy link
Contributor

Tested on MacOS 15, Windows 11, Ubuntu 22.04.3. Approved
#16911 FIXED
#25070 FIXED
#31359 FIXED

@Reedbeta Reedbeta force-pushed the pr/paste-local-time-sig branch from df39f81 to 20ae444 Compare December 15, 2025 19:17
@Reedbeta
Copy link
Contributor Author

Addressed the code review feedback, rebased and cleaned up history a bit.

@zacjansheski
Copy link
Contributor

Looks good!

Tested on MacOS 15, Windows 11, Ubuntu 22.04.3. Approved
#16911 FIXED
#25070 FIXED
#31359 FIXED

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants