#include "pianoinstrument.h"
-
+using namespace Qt;
PianoInstrument::PianoInstrument(QWidget *parent)
: Instrument(parent)
{
- // Set us up to look pretty
- setPaletteBackgroundPixmap(QPixmap("piano.png"));
- setFixedSize(184, 220);
- parentWidget()->setFixedSize(184, 220);
+ background.load("piano.png");
- for(int i = 0; i < 26; i++) {
- oldNotes[i] = false;
- notes[i] = false;
- }
+ memset(oldNotes, 0, sizeof(oldNotes));
+ memset(notes, 0, sizeof(notes));
noteStart = 48;
void PianoInstrument::paintEvent(QPaintEvent *)
{
QPainter paint(this);
+
+ paint.drawPixmap(0, 0, background);
+
paint.setPen(Qt::red);
const int topBlackY = 38;
repaint();
}
-