22#include <QGraphicsRectItem>
34 class PianoKey :
public QGraphicsRectItem
37 explicit PianoKey(QGraphicsItem * parent =
nullptr ): QGraphicsRectItem(parent),
43 PianoKey(
const QRectF &rect,
const bool black,
const int note);
44 void paint(QPainter *painter,
const QStyleOptionGraphicsItem *, QWidget *)
override;
45 int getNote()
const {
return m_note; }
46 void setBrush(
const QBrush& b) { m_brush = b; }
47 void setPressedBrush(
const QBrush& b) { m_selectedBrush = b; }
49 bool isPressed()
const {
return m_pressed; }
50 void setPressed(
bool p);
51 int getDegree()
const {
return m_note % 12; }
52 int getType()
const {
return (m_black ? 1 : 0); }
53 bool isBlack()
const {
return m_black; }
54 const QPixmap& getPixmap()
const;
55 void setPixmap(
const QPixmap& p);
56 QRectF pixmapRect()
const;
57 bool getUsePixmap()
const;
58 void setUsePixmap(
bool usePixmap);
59 void paintPixmap(QPixmap &pixmap,
const QColor& color)
const;
61 static const PianoPalette keyPalette;
65 QBrush m_selectedBrush;