You should call MainWindow::resizeEvent(event) in the end.
Here is another alternate you can try.
{
public:
protected:
{
int h = event->size().height();
f.setPixelSize(h - 20);
setFont(f);
}
};
int main(int argc, char *argv[])
{
SpinBox s;
s.show();
return a.exec();
}
class SpinBox : public QSpinBox
{
public:
explicit SpinBox(QWidget * parent = 0) : QSpinBox(parent) { }
protected:
void resizeEvent(QResizeEvent * event)
{
int h = event->size().height();
QFont f = font();
f.setPixelSize(h - 20);
setFont(f);
QSpinBox::resizeEvent(event);
}
};
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
SpinBox s;
s.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks