Disable QDialogs default close button (upper left “x button”)?

  • Hi,
    To solve the in the title described problem I tried to costumize the QDialog window by @setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint);@ or @setWindowFlags(windowFlags() & ~Qt::WindowCloseButtonHint);@ . Problem is, that both ideas still leave the maximize button and when maximized the close button appears again. Any idea?
    Just using @setWindowFlags(Qt::CustomizeWindowHint)@ solves the problem but leaves the dialog without a border which is a pain in the eyes :D.


  • On Linux with KDE this code helped me:
    setWindowFlags( Qt::Dialog | Qt::WindowTitleHint );

  • I tried your suggestion and unfortunately it does not work. The dialogs close and maximize buttons are still available.

  • On what platform are you working?

  • I am working on Linux Ubuntu 11.10 with the Unity desktop. However, the GUI Ive written wont just be used on the same Linux Ubuntu version especially the desktop is another one (I guess it is the classic Gnome desktop), but it will always be used on Linux Ubuntu.

Log in to reply