Skip to content

Commit 993c798

Browse files
Show localized Piano Keyboard key names (#30389)
* Show localized Piano Keyboard key names The C piano keys in the Piano Keyboard panel are always shown in standard pitch notation. Display the notes with respect to locale by using the strings from `EditPitchBase`. * Change context from EditPitchBase to global/pitchName * Remove spaces from pitch name * Fix dangling pointer
1 parent cae829a commit 993c798

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/notation/view/pianokeyboard/pianokeyboardview.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,12 +266,13 @@ void PianoKeyboardView::paintWhiteKeys(QPainter* painter, const QRectF& viewport
266266

267267
int octaveNumber = (key / 12) - 1;
268268

269-
QString octaveLabel = "C" + QString::number(octaveNumber);
269+
std::string octaveLabel = "C" + std::to_string(octaveNumber);
270+
QString octaveLabelTr = muse::qtrc("global/pitchName", octaveLabel.c_str());
270271
QRect octaveLabelRect(left, top, right - left, bottom - top - bottomOffset);
271272

272273
painter->setPen(backgroundColor);
273274
painter->setFont(m_octaveLabelsFont);
274-
painter->drawText(octaveLabelRect, Qt::AlignHCenter | Qt::AlignBottom, octaveLabel);
275+
painter->drawText(octaveLabelRect, Qt::AlignHCenter | Qt::AlignBottom, octaveLabelTr);
275276
}
276277

277278
painter->translate(-rect.topLeft());

0 commit comments

Comments
 (0)