From 4084486f4f996c9aba339db0231845a655902cc6 Mon Sep 17 00:00:00 2001 From: Marc Sabatella Date: Mon, 28 Dec 2020 12:15:46 -0700 Subject: [PATCH] fix #314854: element offset marked nostyle after edit Resolves: https://musescore.org/en/node/314854 Currently, on any drag operation in edit mode (including "drag" via arrow keys, which uses the same code), the offset is set to NOSTYLE, whereas it should be UNSTYLED (if it was previously styled). The result is that after such an edit, the offset can no longer be reset to its original STYLED state, so it even after a reset of the offset itself, it remains marked as NOSTYLE and will not respond to style changes, There is code in the ordinary drag case (Element::endDrag()) to handle this, but it is missing from the edit mode version. The fix here is to simply reproduce that code in Element::endEditDrag(). --- libmscore/element.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libmscore/element.cpp b/libmscore/element.cpp index d9bf715dbe1b..6a22baa88573 100644 --- a/libmscore/element.cpp +++ b/libmscore/element.cpp @@ -2099,9 +2099,9 @@ QVector Element::genericDragAnchorLines() const if (parent()->isSegment()) { System* system = toSegment(parent())->measure()->system(); const int stIdx = staffIdx(); - yp = system->staffCanvasYpage(stIdx); + yp = system ? system->staffCanvasYpage(stIdx) : 0.0; if (placement() == Placement::BELOW) - yp += system->staff(stIdx)->bbox().height(); + yp += system ? system->staff(stIdx)->bbox().height() : 0.0; //adjust anchor Y positions to staffType offset if (staff()) yp += staff()->staffTypeForElement(this)->yoffset().val()* spatium(); @@ -2191,7 +2191,10 @@ void Element::endEditDrag(EditData& ed) if (eed) { for (const PropertyData &pd : qAsConst(eed->propertyData)) { setPropertyFlags(pd.id, pd.f); // reset initial property flags state - if (score()->undoPropertyChanged(this, pd.id, pd.data)) + PropertyFlags f = pd.f; + if (f == PropertyFlags::STYLED) + f = PropertyFlags::UNSTYLED; + if (score()->undoPropertyChanged(this, pd.id, pd.data, f)) changed = true; } eed->propertyData.clear();