Any idea haw to auto re size the font (point size) of the text in the spin box?


I have a spin box in a window and when resizing the window the spin box is automatically re sized but the point size of the text (font size) in the spin box stays the same.
I've tried to reimplement the MainWindow::resizeEvent() in order to increase the font size according to the new size(height) of the spin box:

void MainWindow::resizeEvent(QResizeEvent */*event*/)
{
ui->spinBox->setStyleSheet(QString("font: %1pt").arg(ui->spinBox- >geometry().height() - 20));
}

but I think that it somehow recursively calls it self, increases the font size to much and crash.