QDialog - How to remove a minimize button

Qt 4.8 based, application - QDialog issue, decrease button

  • Windows and Gnome (linux)

    • A modal dialog box appears with a close button at the top right, and the minimize button is nonexistent .
    • In each dialog box, the Reduce option is grayed out.
    • This makes sense since the QDialog is modal - if you minify it, the entire application will be blocked.

But here comes the problem:

  • in KDE (linux) a minimize-maximize button appears.

It seems to be platform dependent -

I'm not really sure what to do.

Any ideas ...? (I've tried with several windowsFlags already, but couldn't find one that works.


  • setWindowFlags (Qt :: CustomizeWindowHint | Qt :: WindowCloseButtonHint);
  • Qt :: WindowFlags flags = getWindowFlags (); flags | = Qt :: WindowMinimizeButtonHint; setWindowFlags (flags)

--- But the main question is why the behavior on Windows / GNOME is different from KDE


source to share

2 answers

if you want MainWindow to have no buttons, use this in the MainWindow constructor:



and if you only want to remove the minimize button use this:





From Qt Documentation :

On Linux with KDE, this code makes a window without closing and minimizes and maximizes buttons in the title bar.

setWindowFlags( Qt::Dialog | Qt::WindowTitleHint );




All Articles