Files
BeiDou/clickablecombobox.h
2026-04-23 11:45:32 +08:00

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