Rob
Rob

Reputation: 78738

Adding a minimize button to a Qt dialog?

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?

Upvotes: 11

Views: 13448

Answers (2)

bluebrother
bluebrother

Reputation: 8906

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);

Upvotes: 18

Brian R. Bondy
Brian R. Bondy

Reputation: 347546

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

Qt::WindowMinimizeButtonHint

Upvotes: 7

Related Questions