You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PianoKey.cpp 498B

123456789101112131415161718192021222324252627
  1. #include "PianoKey.h"
  2. #include <QBrush>
  3. PianoKey::PianoKey(Tone *tone): tone(tone){
  4. if(tone->getFlatTone()){
  5. setRect(-350+tone->getKeyboardPosition()*100,0, 100, 700);
  6. }
  7. else{
  8. setRect(-350+75+tone->getKeyboardPosition()*100,0, 50, 500);
  9. setZValue(1);
  10. }
  11. setBrush(QBrush(tone->getColor()));
  12. };
  13. PianoKey::~PianoKey(){};
  14. Tone * PianoKey::getTone()const{
  15. return tone;
  16. };
  17. //SLOTS:
  18. void PianoKey::redraw(){
  19. setBrush(QBrush(tone->getColor()));
  20. };