Important: Please read the Qt Code of Conduct -

Disable resizing on a QDialog

  • Hi,

    I'm trying to disable resizing on a QDialog containing a progress bar with the following code:
    QDialog *dialog=new QDialog(some_parent_widget, Qt::Dialog | Qt::CustomizeWindowHint);

    QVBoxLayout *layout=new QVBoxLayout;
    layout->addWidget(new QProgressBar);

    dialog->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

    As a result, the dialog is displayed with the fixed size, but the cursor takes a resizing shape when hovering the border (I would like to disable this), and height can be modified (not width).

    I'm developing with Qt5.1 on Windows 7.

  • Moderators

    AFAIK this isn't possible unless you hide the window frame (FramelessWindowHint), but i think that's not what you want.

  • That's the answer I feared :/. Thanks for the confirmation.

  • it's old but I had the same problem.

    setting minimum and maximum size to the same values did the trick for me

Log in to reply