Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions source/painters/systemrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1215,6 +1215,7 @@ SystemRenderer::drawSymbolsAboveTabStaff(const ConstScoreLocation &location,
break;
case SymbolGroup::TremoloPicking:
renderedSymbol = createTremoloPicking(layout);
renderedSymbol->setX(layout.getPositionX(symbolGroup.getLeftPosition()));
break;
case SymbolGroup::Trill:
renderedSymbol = createTrill(layout);
Expand Down Expand Up @@ -1248,10 +1249,19 @@ SystemRenderer::drawSymbolsAboveTabStaff(const ConstScoreLocation &location,
// standard notation staff.
if (symbolGroup.getSymbolType() != SymbolGroup::Bend)
{
renderedSymbol->setPos(
layout.getPositionX(symbolGroup.getLeftPosition()),
layout.getTopTabLine() - LayoutInfo::STAFF_BORDER_SPACING -
symbolGroup.getHeight() * LayoutInfo::TAB_SYMBOL_SPACING);
const double yPos = layout.getTopTabLine() - LayoutInfo::STAFF_BORDER_SPACING -
symbolGroup.getHeight() * LayoutInfo::TAB_SYMBOL_SPACING;

if (symbolGroup.getSymbolType() == SymbolGroup::TremoloPicking)
{
renderedSymbol->setY(yPos);
Copy link
Member

Choose a reason for hiding this comment

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

I'm not clear how these changes affect the layout

The tremolo picking symbol does this in the case statement above

renderedSymbol->setX(layout.getPositionX(symbolGroup.getLeftPosition()));

which looks equivalent to how the X position is set below in the generic case for other symbols?

}
else
{
renderedSymbol->setPos(
layout.getPositionX(symbolGroup.getLeftPosition()),
yPos);
}
}

if (renderedSymbol)
Expand Down Expand Up @@ -1507,13 +1517,16 @@ QGraphicsItem *SystemRenderer::createTremoloPicking(const LayoutInfo& layout)
{
const double offset = LayoutInfo::TAB_SYMBOL_SPACING / 3;

QFontMetricsF fm(myMusicNotationFont);
const double symbol_width = fm.horizontalAdvance(MusicSymbol::TremoloPicking);

auto group = new QGraphicsItemGroup();

for (int i = 0; i < 3; i++)
{
auto line = new SimpleTextItem(MusicSymbol::TremoloPicking, myMusicNotationFont,
TextAlignment::Baseline, QPen(myPalette.text().color()));
centerHorizontally(*line, 0, layout.getPositionSpacing() * 1.25);
line->setX(0.5 * layout.getPositionSpacing() - symbol_width / 2);
line->setY(-7 + i * offset);
group->addToGroup(line);
}
Expand Down Expand Up @@ -1972,6 +1985,7 @@ SystemRenderer::drawRest(const Position &pos, double x,
{
// Position it in the middle of the staff.
QFont font = MusicFont::getFont(28);
QFontMetricsF fm(font);
double y = layout.getStdNotationLine(3);

QChar symbol;
Expand Down Expand Up @@ -2001,14 +2015,16 @@ SystemRenderer::drawRest(const Position &pos, double x,
break;
}

const double rest_width = fm.horizontalAdvance(symbol);

auto group = new QGraphicsItemGroup();
auto text = new SimpleTextItem(symbol, font, TextAlignment::Baseline, QPen(myPalette.text().color()));
text->setPos(0, y);
group->addToGroup(text);

// Draw dots if necessary.
const QChar dot = MusicSymbol::Dot;
const double dotX = 0.4 * font.pixelSize();
const double dotX = rest_width + 2;
// Position just below second line of staff.
const double dotY = layout.getStdNotationSpace(2);

Expand All @@ -2028,7 +2044,8 @@ SystemRenderer::drawRest(const Position &pos, double x,
}
}

centerHorizontally(*group, x, x + layout.getPositionSpacing() * 1.25);
const double centeredX = x + 0.5 * (layout.getPositionSpacing() - rest_width);
group->setX(centeredX);

group->setParentItem(myParentStaff);
}
Expand Down
Loading