qtutilities/widgets/clearlineedit.h

31 lines
697 B
C
Raw Permalink Normal View History

#ifndef WIDGETS_CLEARLINEEDIT_H
#define WIDGETS_CLEARLINEEDIT_H
2015-04-22 18:57:44 +02:00
2015-09-06 20:19:21 +02:00
#include "./buttonoverlay.h"
2015-04-22 18:57:44 +02:00
#include <QLineEdit>
QT_FORWARD_DECLARE_CLASS(QHBoxLayout)
2015-04-22 18:57:44 +02:00
namespace QtUtilities {
2015-04-22 18:57:44 +02:00
class IconButton;
2017-05-01 03:16:25 +02:00
class QT_UTILITIES_EXPORT ClearLineEdit : public QLineEdit, public ButtonOverlay {
2015-04-22 18:57:44 +02:00
Q_OBJECT
2019-07-07 12:41:11 +02:00
Q_PROPERTY(bool cleared READ isCleared)
2015-04-22 18:57:44 +02:00
public:
explicit ClearLineEdit(QWidget *parent = nullptr);
2018-10-10 21:12:58 +02:00
~ClearLineEdit() override;
bool isCleared() const override;
2017-05-01 03:16:25 +02:00
private Q_SLOTS:
2015-04-22 18:57:44 +02:00
void handleTextChanged(const QString &text);
2018-10-10 21:12:58 +02:00
void handleClearButtonClicked() override;
void handleCustomLayoutCreated() override;
2015-04-22 18:57:44 +02:00
};
} // namespace QtUtilities
2015-04-22 18:57:44 +02:00
#endif // WIDGETS_CLEARLINEEDIT_H