X-Git-Url: https://code.delx.au/virtualtones/blobdiff_plain/e0efeea407809897396731f760ff60e361351d83..dbf3c275fdcd6a94bb63ba2346b8f89dbfe35380:/pianoinstrument.cpp diff --git a/pianoinstrument.cpp b/pianoinstrument.cpp index 127d9e1..0fea76f 100644 --- a/pianoinstrument.cpp +++ b/pianoinstrument.cpp @@ -5,21 +5,16 @@ #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; @@ -57,6 +52,9 @@ QString PianoInstrument::generateHelp() void PianoInstrument::paintEvent(QPaintEvent *) { QPainter paint(this); + + paint.drawPixmap(0, 0, background); + paint.setPen(Qt::red); const int topBlackY = 38; @@ -385,4 +383,3 @@ void PianoInstrument::emitSounds() repaint(); } -