29 lines
530 B
C++
29 lines
530 B
C++
#ifndef CLICKABLECOMBOBOX_H
|
|
#define CLICKABLECOMBOBOX_H
|
|
|
|
#include <QComboBox>
|
|
#include <QMouseEvent>
|
|
|
|
class ClickableComboBox : public QComboBox
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit ClickableComboBox(QWidget *parent = nullptr) : QComboBox(parent) {}
|
|
|
|
signals:
|
|
void clicked();
|
|
|
|
protected:
|
|
void mousePressEvent(QMouseEvent *event) override
|
|
{
|
|
if (event->button() == Qt::LeftButton)
|
|
{
|
|
emit clicked();
|
|
}
|
|
QComboBox::mousePressEvent(event);
|
|
}
|
|
};
|
|
|
|
#endif // CLICKABLECOMBOBOX_H
|