How to hide MaximizeButton of QMainWindow?
-
wrote on 8 Nov 2017, 15:31 last edited by
This do not work:
setWindowFlags(windowFlags() &~ Qt::WindowMaximizeButtonHint);
-
setWindowFlags( Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint );
-
setWindowFlags( Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint );
wrote on 10 Nov 2017, 08:10 last edited by@raven-worx This can disable maximize button but not hide it !
-
@raven-worx This can disable maximize button but not hide it !
@sonichy
i think there is no Qt-way to remove the minimize and maximize buttons.
You may want to set theQt::Tool
flag instead theQt::Window
flag:setWindowFlags( Qt::Tool );
But this also changes the appearance and behavior of the window a bit. But tool-windows do not have minimize and maximize buttons but do also not appear in the taskbar.
-
@sonichy
i think there is no Qt-way to remove the minimize and maximize buttons.
You may want to set theQt::Tool
flag instead theQt::Window
flag:setWindowFlags( Qt::Tool );
But this also changes the appearance and behavior of the window a bit. But tool-windows do not have minimize and maximize buttons but do also not appear in the taskbar.
wrote on 11 Nov 2017, 14:42 last edited by@raven-worx setFixedSize is more simple than setWindowFlags, but also disable Maximize button no hide it.
-
Hi
If Qt::Tool is not what you want, i think disable it is the only options.
It will not be hidden unless a Tool type. -
wrote on 29 Aug 2020, 12:01 last edited by SaaGar
this helped me: Form.setMaximumSize(QtCore.QSize(width, height))
class Ui_Form(object):
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(328, 212) Form.setMaximumSize(QtCore.QSize(352, 189))
-
wrote on 27 Oct 2021, 13:31 last edited byThis post is deleted!