So you have tried "all the ways" but don't mention the obvious Qt::WindowCloseButtonHint. Did you look at the Window Flags Example code?
#include <QtGui>
int main(int argc, char **argv)
{
// or QDialog w;
w.setWindowTitle("Widget");
Qt::WindowFlags f = w.windowFlags();
f |= Qt::CustomizeWindowHint; // set the customise flag
f &= ~(Qt::WindowCloseButtonHint | Qt::WindowMinMaxButtonsHint); // unset the unwanted flags
w.setWindowFlags(f);
w.show();
QTimer::singleShot(30000,
qApp,
SLOT(quit
()));
return app.exec();
}
#include <QtGui>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QWidget w;
// or QDialog w;
w.setWindowTitle("Widget");
Qt::WindowFlags f = w.windowFlags();
f |= Qt::CustomizeWindowHint; // set the customise flag
f &= ~(Qt::WindowCloseButtonHint | Qt::WindowMinMaxButtonsHint); // unset the unwanted flags
w.setWindowFlags(f);
w.show();
QTimer::singleShot(30000, qApp, SLOT(quit()));
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Works as expected on Windows XP. Works on my Linux box with KDE window manager for removing the Close control. Unfortunately the window manager seem to ignore the min/max button hints: if you have a title bar you get these controls.
Bookmarks