How to disable maximize button in QT?
14,863
Solution 1
To turn off the Maximize Button on the default windows, set the max size of your Window on your Ui file.
For example:
You will notice the Maximize button is greyed out when you run your program.
If you want your window to ever only be the one size and give the user no control to change it, set the Geometry and the Minimum size to these same values.
Solution 2
SetWindowsFlags(); didn't work for me on Ubuntu 16.04,but under ui->setupUi(this) I added this line:
setFixedSize(width(), height());
and it works fine.
Solution 3
setWindowFlags(Qt::Drawer);
cool :)
Related videos on Youtube
Author by
Admin
Updated on June 04, 2022Comments
-
Admin almost 2 years
I want to disable maximize button in the Qt
I tried
setWindowFlags( (windowFlags() | Qt::CustomizeWindowHint) & ~Qt::WindowMaximizeButtonHint);
-
Alex F over 5 years
setWindowFlags(windowFlags() &(~Qt::WindowMaximizeButtonHint));
-
-
DaniV over 3 yearsGreat answer, best regards!!