I
have a startup/login dialog, that after the user hits OK, I would like to
hide(), showing messages onto the QSplashScreen.
If
however, there is a problem logging in, a message box pops up, then I show()
dialog and would like to continue.
Here
is the rub, when you hide a dialog, it sets the exit flag in the QDialog’s
event loop. So the next time the dialogs event loop cycles, it exits out.
Is
there anyway, to restart the event loop?
Scott
PS.
Here is code to duplicate the problem’
#include
<QApplication>
#include
<QPushButton>
#include
<QMessageBox>
#include
<QVBoxLayout>
#include
<QLabel>
class
Dialog : public QDialog
{
public:
Dialog( QWidget * parent=NULL ) :
QDialog( parent )
{
QLabel * label = new QLabel( "Hello World" );
QPushButton * btn = new QPushButton( "Push Here" );
connect( btn, SIGNAL( clicked() ), this, SLOT( accept()
) );
QVBoxLayout * layout = new QVBoxLayout( this );
layout->addWidget( label );
layout->addWidget( btn );
}
virtual void
accept()
{
hide(); // comment this out, and everything works