PDA

View Full Version : How to Disabel close button on top corner of widget



jsmith
6th October 2009, 12:01
Hi,
i want to disable close button on top corner of the widget/ show only minimize and maximize buttons. If it is not possible which signal trigger when we close window? Because i have to load data into database when we close widget.

Can any one help me please? Thanks in advance.

yogeshgokul
6th October 2009, 12:18
i want to disable close button on top corner of the widget/ show only minimize and maximize buttons.
I am not sure for enable/disable but you can hide those buttons by playing with WindowsFlags. See this example (http://doc.trolltech.com/4.5/widgets-windowflags.html).


which signal trigger when we close window
For a Dialog
void accepted ()
void rejected ()

For Widget
QWidget::closeEvent()

nhs_0702
3rd May 2010, 10:42
Hi,
i want to disable close button on top corner of the widget/ show only minimize and maximize buttons. If it is not possible which signal trigger when we close window? Because i have to load data into database when we close widget.

Can any one help me please? Thanks in advance.

i want disalbe close button and minimize button and maximize button,how ?

squidge
3rd May 2010, 11:28
Have you tried using GetSystemMenu and then using EnableMenuItem on the "Close" item ? Theoretically, if you disable the Close menu item, it will disable the close button too.

mrondon
2nd August 2010, 17:57
<code>

this->setWindowFlags((
(windowFlags() | Qt::CustomizeWindowHint)
& ~Qt::WindowCloseButtonHint
));
</code>