Skip to content
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

Fix #16396: Tie invisibility crossing system breaks #21347

Merged
merged 1 commit into from
Apr 17, 2024

Conversation

XiaoMigros
Copy link
Contributor

Resolves: #16396

  • 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)

@cbjeukendrup
Copy link
Contributor

cbjeukendrup commented Feb 5, 2024

I found that there are some similar problems:

  • For ties, the same applies to the "color" property too
  • For slurs, it also applies to the "color" property, but seemingly not to the "visible" property
  • For glissandos, it applies to the "visible" property but seemingly not to the "color" property

There may be even more cases (I haven't tested bends for example). And perhaps there are even more properties to which this applies, for example the "auto-place" property.
So we should either fix all cases separately, or look if a more general solution can be found.

Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Feb 5, 2024
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Feb 5, 2024
@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented Feb 5, 2024

tie color and glissando visibility seem easy to fix (1-liner each), slur color not so much (haven't found a way yet)

Actually that's a 1-liner too...

tie color:

diff --git a/libmscore/tie.cpp b/libmscore/tie.cpp
index 8d6f37c4c2..66f7f3bac3 100644
--- a/libmscore/tie.cpp
+++ b/libmscore/tie.cpp
@@ -1010,6 +1010,7 @@ TieSegment* Tie::layoutBack(System* system)
       TieSegment* segment = segmentAt(1);
       segment->setSystem(system);
       segment->setVisible(visible());
+      segment->setColor(color());

       qreal x = system->firstNoteRestSegmentX(true);

glissando visibility:

diff --git a/libmscore/glissando.cpp b/libmscore/glissando.cpp
index 4be6756624..6f36e1f9c1 100644
--- a/libmscore/glissando.cpp
+++ b/libmscore/glissando.cpp
@@ -82,7 +82,7 @@ void GlissandoSegment::draw(QPainter* painter) const
       painter->save();
       qreal _spatium = spatium();

-      QPen pen(curColor(visible(), glissando()->lineColor()));
+      QPen pen(curColor(glissando()->visible(), glissando()->lineColor()));
       pen.setWidthF(glissando()->lineWidth());
       pen.setCapStyle(Qt::FlatCap);
       painter->setPen(pen);

slur color

diff --git a/libmscore/slur.cpp b/libmscore/slur.cpp
index 28302c1b01..4aa7dba0c1 100644
--- a/libmscore/slur.cpp
+++ b/libmscore/slur.cpp
@@ -30,7 +30,7 @@ namespace Ms {

 void SlurSegment::draw(QPainter* painter) const
       {
-      QPen pen(curColor());
+      QPen pen(curColor(slur()->visible(), slur()->color()));
       qreal mag = staff() ? staff()->mag(slur()->tick()) : 1.0;

       //Replace generic Qt dash patterns with improved equivalents to show true dots (keep in sync with tie.cpp)

That's for 3.x though

Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Feb 5, 2024
@Jojo-Schmitz
Copy link
Contributor

That's even better, much more consistent

@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented Feb 5, 2024

But @cbjeukendrup is right: AutoPlace is affected too, albeit different: it disconects regardless whether set before apply a system braek or after, so seems a different issue altogether

Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Feb 5, 2024
@XiaoMigros
Copy link
Contributor Author

Thanks @Jojo-Schmitz for finding the places for slurs and glissandos! I agree that autoplace is a different issue, since this PR currently only changes the visual rendering of the elements and not any actual properties themselves.

@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented Feb 5, 2024

Same issue and fix seems to apply to GuitarBend(Segment and GuitarBendHoldSegment), as far as I can tell.
Might apply to Beam too

@XiaoMigros
Copy link
Contributor Author

Guitar bends seem fine in master (both visibility and color)

Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Feb 11, 2024
Copy link
Contributor

@mike-spa mike-spa left a comment

Choose a reason for hiding this comment

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

There should be a more elegant solution IMO. We have a method called propertyDelegate which is used by SpannerSegments to "delegate" a given property to their Spanner. If you look at SpannerSegment::propertyDelegate you'll see that visible and color are already delegated. Problem is that calling the visible() method returns the internal value directly and bypasses the property routing. I think this may be solved by just calling item->getProperty(Pid::VISIBLE) rather then item->visible().

@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented Feb 22, 2024

I guess it'd need to be item->getProperty(Pid::VISIBLE).toBool()

But what about the color?
Would that be item->getProperty(Pid::COLOR).toInt()? Nah, that doesn't work at all

@XiaoMigros
Copy link
Contributor Author

My understanding would be PropertyValue::fromValue(item->getProperty(Pid::COLOR))

@mike-spa
Copy link
Contributor

My understanding would be PropertyValue::fromValue(item->getProperty(Pid::COLOR))

Yep!

@cbjeukendrup
Copy link
Contributor

PropertyValue::fromValue(item->getProperty(Pid::COLOR)) doesn't make a lot of sense, because getProperty already returns a PropertyValue, so that expression would be equivalent to (but less performant than) just item->getProperty(Pid::COLOR).
If you want to retrieve the property value as a Color type, then item->getProperty(Pid::COLOR).value<Color>() is probably what you want.

Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Feb 22, 2024
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Mar 1, 2024
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Apr 10, 2024
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Apr 10, 2024
@mike-spa mike-spa merged commit 44405df into musescore:master Apr 17, 2024
11 checks passed
@musescore musescore deleted a comment from Jojo-Schmitz Apr 17, 2024
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Apr 17, 2024
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.

Issues with tie invisibility when crossing system break
5 participants