Qt Utilities
5.6.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
Widgets
{
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
30
void
ClearLineEdit::handleTextChanged(
const
QString &
text
)
31
{
32
updateClearButtonVisibility
(!text.isEmpty());
33
}
34
35
void
ClearLineEdit::handleClearButtonClicked()
36
{
37
clear();
38
}
39
40
bool
ClearLineEdit::isCleared
()
const
41
{
42
return
text
().isEmpty();
43
}
44
45
}
Widgets::ButtonOverlay::updateClearButtonVisibility
void updateClearButtonVisibility(bool visible)
Updates the visibility of the clear button.
Definition:
buttonoverlay.cpp:151
clearlineedit.h
Widgets::ClearLineEdit::~ClearLineEdit
~ClearLineEdit()
Destroys the clear combo box.
Definition:
clearlineedit.cpp:24
Widgets::ButtonOverlay
The ButtonOverlay class is used to display buttons on top of other widgets.
Definition:
buttonoverlay.h:17
Widgets::ButtonOverlay::setClearButtonEnabled
void setClearButtonEnabled(bool enabled)
Sets whether the clear button is enabled.
Definition:
buttonoverlay.cpp:61
Widgets
Provides a set of extended widgets such as ClearLineEdit and ClearComboBox.
Definition:
buttonoverlay.h:13
Widgets::ClearLineEdit::isCleared
bool isCleared() const
Returns whether the related widget is cleared.
Definition:
clearlineedit.cpp:40
text
#define text
Definition:
xmlparsermacros.h:14
Widgets::ClearLineEdit::ClearLineEdit
ClearLineEdit(QWidget *parent=nullptr)
Constructs a clear line edit.
Definition:
clearlineedit.cpp:13
Generated on Wed Mar 22 2017 04:03:22 for Qt Utilities by
1.8.13