Search code examples
c++qtuser-interfaceborder

how can I fully disable resizing a window including the resize icon when the mouse hovers the border?


I used: setFixedSize(size()); to stop the window from resizing, but the resize arrows still appear when the mouse is over the border of the window.

Is there a better way to disable window resizing to avoid showing the arrows when crossing the border?


Solution

  • Qt has a windowFlag called Qt::MSWindowsFixedSizeDialogHint for that. Depending on what you exactly want, you want to combine this flag with Qt::Widget, Qt::Window or Qt::Dialog.

    void MyDialog::MyDialog()
    {
      setWindowFlags(Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
    
      ...
    }