Updating fixed window size
-
I've got a magnification setting for my otherwise fixed-size window:
@void MainWindow::SetWidgetSizes ()
{
QFont normal (_labelStarted->font ());
normal.setPointSizeF (_magnification*11);
_labelStarted->setFont (normal);
_labelStarted->updateGeometry ();
setFixedSize (sizeHint().width(), sizeHint().height());
}@
I call this function every time I change the magnification. The text size of the widget changes, but the size of MainWindow doesn't. What do I need to do to get sizeHint() to give the new, updated preferred size for the layout (or to get the layout to recalculate its preferred size)? -
did you try following?
@
void MainWindow::SetWidgetSizes ()
{
QFont normal (_labelStarted->font ());
normal.setPointSizeF (_magnification*11);
_labelStarted->setFont (normal);
_labelStarted->updateGeometry ();
setFixedSize (sizeHint().width(), sizeHint().height());this->updateGeometry(); }
@