如果你使用了exec()函数,那么在调用过程中会对模态进行测试,你可以看看exec()函数原型
int QDialog::exec()
{
#if defined(CHECK_STATE)
if ( !testWFlags(WType_Modal) )
qWarning( "QDialog::exec: Calling this function for a modeless dialog "
"makes no sense" );
#endif
setResult( 0 );
show();
#ifdef _WS_QWS_ // QDialog::show is changed to 3.0 semantics for Qt/Embedded
if ( testWFlags(WType_Modal) && !in_loop ) {
in_loop = TRUE;
qApp->enter_loop();
}
#endif
return result();
}