Qt Utilities  5.12.1
Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models
clearlineedit.cpp
Go to the documentation of this file.
1 #include "./clearlineedit.h"
2 
3 namespace Widgets {
4 
14  : QLineEdit(parent)
15  , ButtonOverlay(this)
16 {
18  connect(this, &ClearLineEdit::textChanged, this, &ClearLineEdit::handleTextChanged);
19 }
20 
25 {
26 }
27 
31 void ClearLineEdit::handleTextChanged(const QString &text)
32 {
34 }
35 
36 void ClearLineEdit::handleClearButtonClicked()
37 {
38  clear();
39 }
40 
42 {
43  return text().isEmpty();
44 }
45 } // namespace Widgets
bool isCleared() const override
Returns whether the related widget is cleared.
~ClearLineEdit() override
Destroys the clear combo box.
void updateClearButtonVisibility(bool visible)
Updates the visibility of the clear button.
The ButtonOverlay class is used to display buttons on top of other widgets.
Definition: buttonoverlay.h:17
void setClearButtonEnabled(bool enabled)
Sets whether the clear button is enabled.
Provides a set of extended widgets such as ClearLineEdit and ClearComboBox.
Definition: buttonoverlay.h:13
#define text
ClearLineEdit(QWidget *parent=nullptr)
Constructs a clear line edit.