lms-audio/src/clickabledoublespinbox.h
2024-06-18 20:23:19 +02:00

34 lines
775 B
C++

#ifndef CLICKABLEDOUBLESPINBOX_H
#define CLICKABLEDOUBLESPINBOX_H
#include <QWidget>
#include <QDoubleSpinBox>
#include <QMouseEvent>
#include <QDebug>
class ClickableDoubleSpinBox : public QDoubleSpinBox
{
Q_OBJECT
public:
bool active = false;
explicit ClickableDoubleSpinBox(QWidget *parent = nullptr);
protected:
void mousePressEvent ( QMouseEvent * event ) {
if (event->button() == Qt::LeftButton) {
emit click();
active = true;
//this->setBackgroundRole(QPalette::BrightText);
} else if (event->button() == Qt::RightButton) {
emit click();
active = false;
//this->setBackgroundRole(QPalette::Shadow);
}
event->accept();
}
signals:
void click();
};
#endif // CLICKABLEDOUBLESPINBOX_H