5#include <QStyleOptionSpinBox>
22 , m_minimumHidden(false)
37void ClearSpinBox::handleValueChanged(
int value)
42void ClearSpinBox::handleClearButtonClicked()
47void ClearSpinBox::handleCustomLayoutCreated()
49 const QStyle *
const s = style();
50 QStyleOptionSpinBox opt;
52 setContentsMarginsFromEditFieldRectAndFrameWidth(
53 s->subControlRect(QStyle::CC_SpinBox, &opt, QStyle::SC_SpinBoxEditField,
this), s->pixelMetric(QStyle::PM_SpinBoxFrameWidth, &opt,
this));
54 connect(
this,
static_cast<void (
ClearSpinBox::*)(
int)
>(&ClearSpinBox::valueChanged),
this, &ClearSpinBox::handleValueChanged);
59 return value() == minimum();
64 if (m_minimumHidden &&
text.isEmpty()) {
67 return QSpinBox::valueFromText(
text);
73 if (m_minimumHidden && (val == minimum())) {
76 return QSpinBox::textFromValue(val);
bool isCleared() const override
Returns whether the related widget is cleared.
QString textFromValue(int val) const override
~ClearSpinBox() override
Destroys the clear spin box.
int valueFromText(const QString &text) const override