Here is a cross-platform way to do this. You have redefined your setVisible method of your QMainWindow or QWidget. In the same way, you can change any window flag that visually affects the window.
The reason this needs to be done is because the class must have window specifications before it actually displays the window.
void setVisible(bool visible)
{
setWindowFlags( windowFlags() & ~Qt::WindowMaximizeButtonHint );
QWidget::setVisible(visible);
}
source
share