musescore / musescore/MuseScore
Add ability to make all keyboard keys labeled.
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 15.1k
- Forks
- 3.3k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 91
Description
Your idea
Add ability to make all keyboard keys labeled.
Problem to be solved
It would make it easier for beginners
Prior art
No response
Additional context
files which need to be altered(i don't know how to make functional menu option and this is just my opinion/speculation)
in MuseScore/src/notation/view/pianokeyboard/pianokeyboardview.cpp
void PianoKeyboardView::paintWhiteKeys(QPainter* painter, const QRectF& viewport)
...
if (key % 12 == 0) {
// Draw octave label
qreal availableHeight = m_whiteKeyHeight - m_blackKeyHeight;
qreal requiredHeight = m_octaveLabelsFont.pixelSize();
qreal bottomOffsetToCenterTextInAvailableSpace = (availableHeight - requiredHeight) / 2;
constexpr qreal maxBottomOffset = 8.0;
constexpr qreal defaultBottomOffset = 8.0;
qreal bottomOffset = std::min({
bottomOffsetToCenterTextInAvailableSpace,
defaultBottomOffset * m_keyWidthScaling,
maxBottomOffset
});
int octaveNumber = (key / 12) - 1;
QString octaveLabel = "C" + QString::number(octaveNumber);
QRect octaveLabelRect(left, top, right - left, bottom - top - bottomOffset);
painter->setPen(backgroundColor);
painter->setFont(m_octaveLabelsFont);
painter->drawText(octaveLabelRect, Qt::AlignHCenter | Qt::AlignBottom, octaveLabel);
}
painter->translate(-rect.topLeft());
}
}
and MuseScore/src/notation/view/pianokeyboard/pianokeyboardpanelcontextmenumodel.cpp
MenuItem* PianoKeyboardPanelContextMenuModel::makeViewMenu
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with PianoKeyboardView::paintWhiteKeys in MuseScore/src/notation/view/pianokeyboard/pianokeyboardview.cpp and the makeViewMenu entry in pianokeyboardpanelcontextmenumodel.cpp. Trace how octave labels are currently drawn and how view-menu options are assembled. Done means a usable option can display labels on all keyboard keys, while preserving the existing octave-label behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100