Re: Disable Close button (X) of a QDialog
Quote:
Originally Posted by
BrainB0ne
That's very nice to hear/know when i'm going to use Qt 4.5 or higher in the future! :)
Very nice, thanks, but, is it possible to disable (X) in dialog that resided on QGraphicsView, I've read in the docs that is NOT possible ...
Re: Disable Close button (X) of a QDialog
I use the same code in QT4.5, but it doesn't work!!
why??
Re: Disable Close button (X) of a QDialog
Quote:
Originally Posted by
blue.death
Anybody knows how to disable that nasty little button on X11 and Mac OS X??
I have the exact same problem. I'm using Qt 4.3 and don't have the luxury of Qt::WindowMinMaxButtonHint. :(
I need to keep the title bar empty, so Qt::FramelessWindowHint makes the message box a bit bare.
It was suggested that we can inherit a QDialog box and disable it there...would anyone else know of any other suggestions?
Thanks,
Kat
Re: Disable Close button (X) of a QDialog
Quote:
Originally Posted by
kyue
It was suggested that we can inherit a QDialog box and disable it there...would anyone else know of any other suggestions?
try upgrading to qt 4.5
Re: Disable Close button (X) of a QDialog
Try this
Code:
#include <qapplication.h>
#include <qevent.h>
#include <qpushbutton.h>
#include <qdialog.h>
#include <qmessagebox.h>
#include <iostream>
{
public:
}
protected:
event->ignore();
QMessageBox::information( this,
"Close?",
"Close? No way!" );
}
};
int main( int argc, char** argv )
{
MyDialog dlg;
QObject::connect( button,
SIGNAL( clicked
() ),
&app, SLOT( quit() ) );
dlg.resize( 300, 300 );
dlg.show();
return app.exec();
}
Re: Disable Close button (X) of a QDialog
Quote:
Originally Posted by
shad
try upgrading to qt 4.5
Sorry, I didn't see these replies until now. It's not an option for us right now.
Re: Disable Close button (X) of a QDialog
Quote:
Originally Posted by
lni
Try this
Code:
#include <qapplication.h>
#include <qevent.h>
#include <qpushbutton.h>
#include <qdialog.h>
#include <qmessagebox.h>
#include <iostream>
{
public:
}
protected:
event->ignore();
QMessageBox::information( this,
"Close?",
"Close? No way!" );
}
};
int main( int argc, char** argv )
{
MyDialog dlg;
QObject::connect( button,
SIGNAL( clicked
() ),
&app, SLOT( quit() ) );
dlg.resize( 300, 300 );
dlg.show();
return app.exec();
}
Thank you for your reply. Yes, this was a solution that was considered. I'm wondering if there is another solution where we don't have to inherit and ignore the closeEvent...
Re: Disable Close button (X) of a QDialog
If this helps anyone, you can remove the three buttons on the top left (close, minimize, maximize) on a Mac and leaving the title there using:
Code:
setWindowModality(Qt::WindowModal);
Re: Disable Close button (X) of a QDialog
Re: Disable Close button (X) of a QDialog
hi
this did the job for me (on a QDialog based class) :
Code:
Qt::WindowFlags flags = windowFlags() ;
flags |= Qt::CustomizeWindowHint ;
flags &= ~Qt::WindowCloseButtonHint ;
setWindowFlags( flags ) ;