- Derive from
QAbstractSpinBox
. - Add a
QValidator
to theQLineEdit
to only allow valid int64 values. - Add a property called
value
to provide access to the int64 member that actually holds the value. - Reimplment
stepBy(int steps)
to modify the number. - Implement the methods and properties specific to
QSpinBox
that you are interested in (minimum/maximum limits, prefix, suffix, etc).
Essentially you are maintaining two states: one is the actual int64 value, the other is the text held by the QLineEdit
. Usually this is just updated by:
lineEdit()->setText(QString::number(myNumber));
But it will have to be tweaked slightly if the user wants a prefix or suffix.