47 lines
1.1 KiB
C++
47 lines
1.1 KiB
C++
#ifndef ELASEARCHEDIT_H
|
|
#define ELASEARCHEDIT_H
|
|
|
|
#include <QWidget>
|
|
#include <QHBoxLayout>
|
|
#include <QList>
|
|
#include "ElaLineEdit.h"
|
|
#include "ElaToolButton.h"
|
|
|
|
class ElaSearchEdit : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit ElaSearchEdit(QWidget* parent = nullptr);
|
|
~ElaSearchEdit() override;
|
|
|
|
QString text() const;
|
|
void setText(const QString& text);
|
|
void setPlaceholderText(const QString& placeholderText);
|
|
void setFixedSize(const QSize& size);
|
|
void setFixedSize(int w, int h);
|
|
void setFixedHeight(int h);
|
|
|
|
bool isExactMatch() const;
|
|
void setExactMatch(bool exact);
|
|
|
|
signals:
|
|
void textChanged(const QString& text);
|
|
void returnPressed();
|
|
void exactMatchChanged(bool exact);
|
|
void searchClicked();
|
|
|
|
private:
|
|
void initUI();
|
|
void connectSignals();
|
|
void resetInputMargin();
|
|
ElaToolButton* addToolButton(QWidget* parent, ElaIconType::IconName icon, const QString& tooltip, const QSize& size, bool checkable = false, bool checked = false);
|
|
|
|
ElaLineEdit* m_lineEdit;
|
|
ElaToolButton* m_searchBtn;
|
|
ElaToolButton* m_exactMatchBtn;
|
|
bool m_exactMatch;
|
|
};
|
|
|
|
#endif // ELASEARCHEDIT_H
|