This may be a little late, but you need to clear the default Windows Hint first. The following will enable the Close and Maximize button, and disable the Minimize button:
setWindowFlags(windowFlags() | Qt::CustomizeWindowHint);
setWindowFlags(windowFlags() | Qt::CustomizeWindowHint);
To copy to clipboard, switch view to plain text mode
Now...I too need to find a way to disable the Maximize button. Here are some of the methods I've tried and none of the them were successful for me...
Qt::WindowFlags flag = windowFlags() | Qt::CustomizeWindowHint;
//flag ^= Qt::WindowMaximizeButtonHint;
//flag &= ~Qt::WindowMinMaxButtonsHint;
//flag &= ~Qt::WindowMinimizeButtonHint;
//flag &= ~Qt::WindowMaximizeButtonHint;
//flag |= Qt::WindowSystemMenuHint;
setWindowFlags(flag);
Qt::WindowFlags flag = windowFlags() | Qt::CustomizeWindowHint;
//flag ^= Qt::WindowMaximizeButtonHint;
//flag &= ~Qt::WindowMinMaxButtonsHint;
//flag &= ~Qt::WindowMinimizeButtonHint;
//flag &= ~Qt::WindowMaximizeButtonHint;
//flag |= Qt::WindowSystemMenuHint;
setWindowFlags(flag);
To copy to clipboard, switch view to plain text mode
Bookmarks