#ifndef CLICKABLEDOUBLESPINBOX_H #define CLICKABLEDOUBLESPINBOX_H #include #include #include #include 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