11

I want to disable maximize button in the Qt

I tried

setWindowFlags( (windowFlags() | Qt::CustomizeWindowHint) & ~Qt::WindowMaximizeButtonHint); 

3 Answers3

9

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.

Reagan Ochora
  • 1,642
  • 1
  • 19
  • 22
9

To turn off the Maximize Button on the default windows, set the max size of your Window on your Ui file.

For example:

enter image description here

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.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
StackAttack
  • 1,139
  • 1
  • 9
  • 15
1
setWindowFlags(Qt::Drawer);

cool :)

Mahdi
  • 87
  • 5