添加项目文件。
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// Created by Administrator on 2026/1/21.
|
||||
//
|
||||
|
||||
#ifndef CLICKABLE_LINE_EDIT_H
|
||||
#define CLICKABLE_LINE_EDIT_H
|
||||
#include <QLineEdit>
|
||||
#include <QMouseEvent>
|
||||
|
||||
class ClickableLineEdit : public QLineEdit {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ClickableLineEdit(QWidget *parent = nullptr) : QLineEdit(parent) {}
|
||||
|
||||
signals:
|
||||
void clicked();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event) override {
|
||||
QLineEdit::mousePressEvent(event);
|
||||
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
emit clicked(); // 发射自定义信号
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif //CLICKABLE_LINE_EDIT_H
|
||||
Reference in New Issue
Block a user