5#include <QStyleOptionComboBox>
15static inline auto *getComboBoxLineEdit(QComboBox *comboBox)
17 comboBox->setEditable(
true);
18 return comboBox->lineEdit();
43void ClearComboBox::handleTextChanged(
const QString &
text)
48void ClearComboBox::handleClearButtonClicked()
53void ClearComboBox::handleCustomLayoutCreated()
55 const QStyle *
const s = style();
56 QStyleOptionComboBox opt;
58 setContentsMarginsFromEditFieldRectAndFrameWidth(
59 s->subControlRect(QStyle::CC_ComboBox, &opt, QStyle::SC_ComboBoxEditField,
this), s->pixelMetric(QStyle::PM_ComboBoxFrameWidth, &opt,
this));
60 connect(
this, &ClearComboBox::currentTextChanged,
this, &ClearComboBox::handleTextChanged);
65 return currentText().isEmpty();
~ClearComboBox() override
Destroys the clear combo box.
bool isCleared() const override
Returns whether the related widget is cleared.