aboutsummaryrefslogtreecommitdiff
path: root/simple-visualization/qmppianowidget.hpp
blob: 22af6cea9e6a24772695d054a236d1d235dece18 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef QMPPIANOWIDGET_HPP
#define QMPPIANOWIDGET_HPP

#include <QWidget>
#include <bitset>

class qmpPianoWidget : public QWidget
{
		Q_OBJECT
	public:
		explicit qmpPianoWidget(QWidget *parent = nullptr);
		void setKeyState(int key,bool state);
		void reset();
		QSize minimumSizeHint()const override;

	protected:
		void paintEvent(QPaintEvent *event)override;

	private:
		bool keystates[128];
		QRectF getKeyRect(int key);
		void paintKey(QRectF keyrect,QColor keycolor);
};

#endif // QMPPIANOWIDGET_HPP