QDialog::exec() cereates no modal dialog
Hi,
in my application I use many different QDialogs and call them via exec() - method. Therefor the user sould not be able to close the main application widget or to use the menu of the main app widget.
It works for most of the QDialogs, but for one of them it doesn't: main app widget can be closed while this QDialog is open. The only difference to the other dialogs is, that this dialog has many widgets inside (it's a tab widget dialog). I also made an explicitly call to setModal(true) - doesn't work :( .
This is how I create the dialog:
m_pQDlgConfig = new SGenConfigDialog( this, "1" );
connect( m_pQDlgConfig, SIGNAL(signalUpdateTDMainWindow()), this, SLOT(SlotUpdateXSDTreeView()) );
m_pQDlgConfig->setModal(true);
if ( m_pQDlgConfig->exec() == QDialog::Accepted )
{
ASSERT("E");
} else {
ASSERT("E");
}
if ( m_pQDlgConfig )
{
delete m_pQDlgConfig;
m_pQDlgConfig = NULL;
}
where SGenConfigDialog is a QDialog -derived class.
I'm now using Qt 3.3.5 on Windows, developping under .NET03.
Has anybody an idea?
Re: QDialog::exec() cereates no modal dialog
Confusing !!! "exec()" should make your dialogs modal by default! Moreover you use "setModal(true)" and it doesn't make them modals :confused:
It may be a bug in your version, or you may have forgotten to use that function with all dialogs that need it...
If you doesn't forget anything I see only two ways to fix it :
- recompiling you Qt 3 version
- porting to Qt 4 (I've never heard of such a bug under Qt 4 and all the dialogs I call through "exec()" are modals!!!)
Re: QDialog::exec() cereates no modal dialog
Quote:
Originally Posted by fullmetalcoder
If you doesn't forget anything I see only two ways to fix it :
- recompiling you Qt 3 version
- porting to Qt 4 (I've never heard of such a bug under Qt 4 and all the dialogs I call through "exec()" are modals!!!)
no i dont think that.....i use qt3.3.5 and its work good with modal dialogs!
I think sboesch hide for us some details...for example what it is?
Code:
connect( m_pQDlgConfig, SIGNAL(signalUpdateTDMainWindow()), this, SLOT(SlotUpdateXSDTreeView()) );
Re: QDialog::exec() cereates no modal dialog
Well,
connect( m_pQDlgConfig, SIGNAL(signalUpdateTDMainWindow()), this, SLOT(SlotUpdateXSDTreeView()) );
is a connection to the parent widget of the Dialog, which is needed to update a QListView when some data is being changed in the dialog.
I alos thought about that being a problem and tried it without that connection - didn't work either.
I'm not able to post all of the dialogs code - it has some 10,000 lines of code...
I just wonder, if anybody has the same problem before, because I don't have an idea, what could be the problem.
Re: QDialog::exec() cereates no modal dialog
Quote:
Originally Posted by sboesch
m_pQDlgConfig = new SGenConfigDialog( this, "1" );
Where does "this" point?
Did you reimplement the exec() method in SGenConfigDialog?
Re: QDialog::exec() cereates no modal dialog
this points to a QMainWindow derived class.
exec() is not reimplemented in SGenCondifDialog.
Re: QDialog::exec() cereates no modal dialog
Could you provide a minimal example which reproduces the problem?
Re: QDialog::exec() cereates no modal dialog
Quote:
Originally Posted by sboesch
exec() is not reimplemented in SGenCondifDialog.
What happens in the SGenCondifDialog constructor? How do you initialize its base class?
Re: QDialog::exec() cereates no modal dialog
sboesch, I had a similar problem and the cause was that I called to show inside the dialog and it seems that blocked the modality or something.