How to hide the dialog window close button?
-
Its the correct function, the usage is the following:
- "QWidget::setWindowFlags":http://doc.qt.nokia.com/latest/qwidget.html#windowFlags-prop
- "Qt::WindowsFlags":http://doc.qt.nokia.com/latest/qt.html#WindowType-enum
@
MyDialog::MyDialog(QWidget* pParent) :
QDialog(pParent, Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint )
{
}
@ -
I don't remember if you have any flag to dissable the close button, but in that scenario, you could apply the:
Qt::FramelessWindow
Flag in the initialization of the QDialog parent, and that will allow you to dismiss the NonClient Area (titlebar, the window borders), in that case you have to provide a way to close the window.Regards!
-
[quote author="Gerolf" date="1299145299"]Its the correct function, the usage is the following:
- "QWidget::setWindowFlags":http://doc.qt.nokia.com/latest/qwidget.html#windowFlags-prop
- "Qt::WindowsFlags":http://doc.qt.nokia.com/latest/qt.html#WindowType-enum
@
MyDialog::MyDialog(QWidget* pParent) :
QDialog(pParent, Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint )
{
}
@[/quote]Thanks, your methods is fantancy. But's a little flaw. the Min button and Max button not hint.
-
@giesbert said in How to hide the dialog window close button?:
if you don't want m in/max button, remove them from the flas.
You mean like this?
: QDialog(parent, Qt::CustomizeWindowHint | Qt::WindowTitleHint )
That does not work, the min/max buttons, i.e. the small arrows on the right hand side, are still there. I have tried various combinations of flags, but I cannot get rid of those arrows. I don't want to remove the top panel.