How to disconnect buttons (setEnabled(false)) close, maximize and minimize of QMainWindow? Or make the window size fixed.
How to disconnect buttons (setEnabled(false)) close, maximize and minimize of QMainWindow? Or make the window size fixed.
Qt Code:
setWindowFlags ( Qt::WindowFlags type )To copy to clipboard, switch view to plain text mode
Insanity: doing the same thing over and over again and expecting different results.
Albert Einstein
I don't know if it's possible to do what you want to. If you call setWindowFlags(Qt::CustomizeWindowHint) you remove all buttons and a title bar from a window but you still can resize it. Each flag from Qt namespace simply adds a button one by one and other window features. You should read this:
http://doc.qt.nokia.com/4.7-snapshot...indowType-enum
Perhaps there is a lower level hard coding fulfil this but I don't know about it.
Works well doing:But, using the class QMainWindow some event is enabled and you can resize the window. An attached image shows where the event occurs.Qt Code:
setWindowFlags( Qt::WindowTitleHint | Qt::CustomizeWindowHint | Qt::MSWindowsFixedSizeDialogHint);To copy to clipboard, switch view to plain text mode
programa.png
Hi. Good job with what you have achieved so far. In your example though I still could still resize a window. I have also found the function setFixedSize(windoWidth, windowHeigth). If you use it as follows:
MainWindow w;
w.setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint ); // or whatever other flags
w.setFixedSize(w.width(),w.height());
w.show();
You may have your window fixed but I still have seen the "resize" icon at the window's corner.
Reference:
http://stackoverflow.com/questions/6...e-a-fixed-size
Last edited by ZikO; 12th August 2012 at 03:04.
jaca (12th August 2012)
Bookmarks