PDA

View Full Version : QDialog::exec() cereates no modal dialog



sboesch
31st January 2006, 15:17
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?

fullmetalcoder
31st January 2006, 15:27
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!!!)

zlatko
31st January 2006, 15:40
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?


connect( m_pQDlgConfig, SIGNAL(signalUpdateTDMainWindow()), this, SLOT(SlotUpdateXSDTreeView()) );

sboesch
3rd February 2006, 16:47
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.

jacek
3rd February 2006, 16:54
m_pQDlgConfig = new SGenConfigDialog( this, "1" );
Where does "this" point?

Did you reimplement the exec() method in SGenConfigDialog?

sboesch
6th February 2006, 07:58
this points to a QMainWindow derived class.

exec() is not reimplemented in SGenCondifDialog.

wysota
6th February 2006, 09:57
Could you provide a minimal example which reproduces the problem?

jacek
6th February 2006, 15:17
exec() is not reimplemented in SGenCondifDialog.
What happens in the SGenCondifDialog constructor? How do you initialize its base class?

SkripT
27th March 2006, 18:03
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.