Skip to content

fix #313977: avoid adding a palette element twice on double-click #7590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 4, 2021

Conversation

dmitrio95
Copy link
Contributor

Resolves: https://musescore.org/en/node/313977

The issue doesn't happen in MuseScore 3.4.2 but happens in the 3.5 version. The possible reason is that #5474 has occasionally reverted the previous commit which had fixed this issue, 77e4347. This pull request returns the empty double-click handler back. Removing the handler entirely causes two onClicked events being triggered and results in identical elements being added as well, so we have to put an empty handler there to prevent this.

const index = paletteCell.modelIndex;
paletteView.selectionModel.setCurrentIndex(index, ItemSelectionModel.Current);
paletteView.paletteController.applyPaletteElement(index, mouse.modifiers);
// Empty handler to avoid onClicked being triggered twice on double-click.
Copy link
Contributor

Choose a reason for hiding this comment

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

I love issues getting fixed by removing code ;-)

@vpereverzev vpereverzev merged commit a2f800a into musescore:3.x Mar 4, 2021
@dmitrio95 dmitrio95 deleted the palettes-double-click branch March 4, 2021 21:00
@Jojo-Schmitz
Copy link
Contributor

I wonder whether this would need to get ported to master

@Jojo-Schmitz
Copy link
Contributor

As far as I can tell the culprit code is still in master, see

onDoubleClicked: {
const index = paletteCell.modelIndex;
paletteView.selectionModel.setCurrentIndex(index, ItemSelectionModel.Current);
paletteView.paletteController.applyPaletteElement(index, ui.keyboardModifiers());
}

@Jojo-Schmitz
Copy link
Contributor

See #11462

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants