QSpinBox *spinBox = new QSpinBox(); spinBox->setRange(0, 100);
QSpinBox *spinBox = new QSpinBox(); spinBox->setRange(-100, 100);This code creates a new spin box widget and sets its range to values between -100 and 100. Both examples use the Qt library package to define the QSpinBox class and its setRange() function.