How to Enable/Disable Qt Close Button

Posted on Posted in Qt Tutorials, Tutorials

You can use the following piece of code in your Qt Window to disable Close (“X”) button in the title bar.

| Qt::WindowMinimizeButtonHint
| Qt::WindowMaximizeButtonHint);

Alternatively, you can use this code to enable it:

| Qt::WindowMinimizeButtonHint
| Qt::WindowMaximizeButtonHint
| Qt::WindowCloseButtonHint);

As you can see, WindowCloseButtonHint flag is responsible for enabling/disabling Close button in title bar.

Leave a Reply

Your email address will not be published. Required fields are marked *