How to hide windows close/minimize/maximize button on titlebar?
-
wrote on 7 Jun 2011, 01:13 last edited by
Which platform are you talking about? Windows, Mac, Linux?
-
wrote on 7 Jun 2011, 03:27 last edited by
Look at setWindowsFlags() method.
"The CustomizeWindowHint flag is used to enable customization of the window controls. This flag must be set to allow the WindowTitleHint, WindowSystemMenuHint, WindowMinimizeButtonHint, WindowMaximizeButtonHint and WindowCloseButtonHint flags to be changed."
-
wrote on 7 Jun 2011, 06:41 last edited by
there is a good example in Qt Demo.
examples > widgets > Window flags
You can experiment using different settings.
-
wrote on 7 Jun 2011, 14:55 last edited by
I am working on Windows. I checked the "Window flags" example before and it would fit my application.
If I set:
@setWindowFlags(Qt::WindowTitleHint | Qt::CustomizeWindowHint);@
I can get rid of 3 buttons. But the icon also gone(I need the icon). If I do not set as above, the 3 buttons always there.
-
wrote on 7 Jun 2011, 16:36 last edited by
Try
@setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint);@ -
wrote on 9 Jun 2011, 18:56 last edited by
not work.
-
wrote on 9 Jun 2011, 20:51 last edited by
you have to add the Qt::WindowSystemMenuHint for the icon. But take care, it might also add the close button (see docs).
EDIT: Hiding the buittons from the title bar will not disable the functions from the system menu....
-
wrote on 10 Jun 2011, 15:40 last edited by
using Qt::WindowSystemMenuHint will not hide close button. But at least it disable the close button. I might use it. But I wish only icon, title on title bar. Nothing else.
-
wrote on 10 Jun 2011, 17:12 last edited by
I think this is a limitation by the Windows window system. You will experience the same problems in native Windows code, eg. C#.
What you can do without fail is using a frameless window (Qt::FramelessWindowHint) and draw your own icon and title.
-
wrote on 16 Nov 2011, 09:45 last edited by
try setting the form's minimum size equal to the form's maximum size. it worked for me. except for the close button.... I use the QcloseEvent() to handle that...