Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding a minimize button to a Qt dialog?

Tags:

c++

qt

qt4

I have created a QDialog based app using Qt Creator and all is well other than the dialog has no minimize button. How can I add one? Is there a property in the designer that I can set?

like image 923
Rob Avatar asked Jul 03 '09 21:07

Rob


2 Answers

You can't add the minimize button yourself as it is handled by the window manager. You can tell the window manager how your dialog should be handled using Window Manager hints. This is done using the windowFlags property of your widget. There's also an example demonstrating this.

setWindowFlags(windowFlags() | Qt::WindowMinimizeButtonHint);
like image 195
bluebrother Avatar answered Oct 11 '22 22:10

bluebrother


Use the QDialog constructor's Qt::WindowFlags for minimize.

Qt::WindowMinimizeButtonHint

like image 25
Brian R. Bondy Avatar answered Oct 11 '22 22:10

Brian R. Bondy