you should put all of your widgets into a layout, layout(s) automatically resize all of your widget(s) inside QMainWindow when user made any change in QMainWindow's size, you can add layout both via Qt Creator IDE and Coding.
UPDATE:
if you add layouts in Qt Creator, layouts automatically coded in moc file and no need to made any changes in their behaviour via coding by user.
but via coding in class constructor:
QVBoxLayout *layout = new QVBoxLayout(parent);
layout->addWidget(widget1);
layout->addWidget(widget2);
layout->addWidget(widget3);
this->setLayout(layout);
but if want to change QLabel's font, this is done by resizeEvent in QMainWindow, so for any change in size of MainWindow, resizeEvent triggered, so you use this code:
in mainwindow.h you declare resizeEvent:
protected:
void resizeEvent(QResizeEvent* event);
in mainwindow.cpp implement resizeEvent:
void MainWindow::resizeEvent(QResizeEvent *event)
{
MainWindow::resizeEvent(event);
if(this)
{
// QLabel process
}
}
scale
on the suppliedQPainter
. I'm not sure if this cascades through the subwidgets though, and even if so, border lines etc would be scaled as well. – Tim Meyer