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