|
From: Yoda-JM <yo...@us...> - 2011-02-22 12:34:19
|
Author: Vincent Le Ligeour <yo...@us...>
Date: Tue Feb 22 13:35:48 2011 +0100
Added piano display
---
notegraphwidget.cc | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/notegraphwidget.cc b/notegraphwidget.cc
index dcf85d0..039419c 100644
--- a/notegraphwidget.cc
+++ b/notegraphwidget.cc
@@ -192,6 +192,22 @@ void NoteGraphWidget::paintEvent(QPaintEvent*) {
for (int i = 1; i < 4; ++i)
painter.drawLine(x1, n2px(i*12), x2, n2px(i*12));
+ // Piano
+ MusicalScale scale;
+ QColor background;
+ int note_width = n2px(0)-n2px(1);
+ pen.setWidth(2); pen.setColor(QColor("#c0c0c0"));
+ painter.setPen(pen);
+ for (int i = 1; i < 12*4; ++i) {
+ if(scale.isSharp(i)) {
+ background = QColor("#000000");
+ } else {
+ background = QColor("#ffffff");
+ }
+ painter.fillRect(x1, n2px(i)-note_width/2, 50, note_width, background);
+ painter.drawRect(x1, n2px(i)-note_width/2, 50, note_width);
+ }
+
// Selection box
if (!m_mouseHotSpot.isNull()) {
QPoint mousep = mapFromGlobal(QCursor::pos());
|