Important: Please read the Qt Code of Conduct -

[SOLVED]unfix a window previously fixed

  • In my application, I use an resizable window.
    Sometimes, I pop up a widget. When this widget is on, I don't want the user to be able to resize the window.
    For this, I use setFixedSize on the mainWindow. Until here everything works.

    Once the widget closes up, I would like the user to be able to resize the window again. But there's no method like setResizable of unfixedSize.

    Is there a way to do it tho?


  • [quote author="Qt Assistant" date="0"]void QWidget::setFixedSize ( const QSize & s )

    Sets both the minimum and maximum sizes of the widget to s, thereby preventing it from ever growing or shrinking.
    This will override the default size constraints set by QLayout.
    To remove constraints, set the size to QWIDGETSIZE_MAX.
    Alternatively, if you want the widget to have a fixed size based on its contents, you can call QLayout::setSizeConstraint(QLayout::SetFixedSize);
    See also maximumSize and minimumSize.

  • Did you read the docs?

    "Set the size using QWIDGETSIZE_MAX ":

  • Perfectely worked.

    For the one who has the problem.

    first : setFixedSize(size());


    Thanks for help

Log in to reply