aboutsummaryrefslogblamecommitdiff
path: root/simple-visualization/qmppianowidget.hpp
blob: aec034d4832983d7b088bee1075d5709a6ec4963 (plain) (tree)
1
2
3
4
5
6
7
8







                                     







                                                       
 

                                                
 



                                                   


                            
#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;
    bool hasHeightForWidth()const override;
    int heightForWidth(int w)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