I have a QLineEdit where the user should input only numbers.
QLineEdit
So is there a numbers-only setting for QLineEdit?
QLineEdit::setValidator(), for example:
QLineEdit::setValidator()
myLineEdit->setValidator( new QIntValidator(0, 100, this) );
or
myLineEdit->setValidator( new QDoubleValidator(0, 100, 2, this) );
See: QIntValidator, QDoubleValidator, QLineEdit::setValidator