Double-clicking uneditable element disables further editing

• Feb 24, 2012 - 15:38
S4 - Minor

Create a new default piano score. Double-click on a specific element like instrument name or clef. Now you can no longer use the mouse to double-click and edit other elements like frame text, frames, time sig, etc. The only way to get edit mode back is to right-click on an element and select Edit Element.

Win7 32-bit


Still an issue under the latest GIT 4ee8a2e. Double-clicking on any element that can't be edited results in all double-click editing being unavailable until you manually select "Edit element" from the right-click context menu.

I found this line of code in scoreview.cpp in 1.2:

virtual bool eventTest(QEvent* event) {
if (!QMouseEventTransition::eventTest(event)
return false;

was changed to this in musescore 2.0:

virtual bool eventTest(QEvent* event) {
if (!QMouseEventTransition::eventTest(event) || canvas->getOrigEditObject())
return false;

The condition || canvas->getOrigEditObject()) seem to have been added to avoid a crash. With this additional condition (canvas->getOrigEditObject()) when you double click an element that isn't editable, double-click stops working.

But by removing this condition, then there is a crash when you double click an element that is already being edited.

This is still an issue, c513dd7. Double-clicking the first barline at the beginning of any system of a score prevents further editing. The treble clef time sig caused this as well, but it's not always reproducible with other elements.

Title [trunk] r5368 Double-clicking certain elements disables editing Double-clicking uneditable element disables further editing
Status (old) active patch (code needs review)

I don't know the ins and outs of mouse event handling, but the following seems to work for me. It fixes the problem, doesn't introduce a crash on double clicking an already-being-edited object, and doesn't seem to have any other other ill effects that I can see (single click still works normally, etc). All I do is not call setEditObject is the object is not editable:

Double-clicking the instrument name, the first line of the staff, or any clef after the first one on the first staff are the things that can cause this bug. Ironically they are the items where the menu item "Edit element" is greyed out by default so it sounds like your fix will handle it.

Now, why editing is allowed on the clefs in the first system is beyond me.

In d8481bd5cc clefs are not editable anymore, first system or not. Previously they inherited the behavior from Element and so were editable if not "generated". The first clef is not generated, while the other ones at the start of system are, since they are not "fixed" and can "move" when the line break changes.