2025-03-14 15:07:39 +08:00
|
|
|
|
#ifndef CLINEEDITWITHBT_H
|
|
|
|
|
|
#define CLINEEDITWITHBT_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
|
|
|
|
|
|
class QLineEdit;
|
|
|
|
|
|
class QToolButton;
|
|
|
|
|
|
class CLineEditWithBt : public QWidget
|
|
|
|
|
|
{
|
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
public:
|
|
|
|
|
|
enum Option{
|
|
|
|
|
|
GetFile = 0,
|
|
|
|
|
|
GetPath = 1
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
CLineEditWithBt(QWidget *parent = 0, const QString& filePath = "", Option option = GetFile);
|
|
|
|
|
|
~CLineEditWithBt();
|
|
|
|
|
|
|
|
|
|
|
|
void setText(const QString& text);
|
|
|
|
|
|
QString text();
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
bool eventFilter(QObject *watched, QEvent *event);
|
|
|
|
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
|
void getFilePath();
|
|
|
|
|
|
void setFilePath(const QString& name);
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
QString m_filePath;
|
|
|
|
|
|
Option m_option;
|
|
|
|
|
|
QLineEdit *m_edit;
|
|
|
|
|
|
QToolButton *m_button;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // CLINEEDITWITHBT_H
|