PDA

View Full Version : Different behavior of QDialog::exec() under Windows and under Linux



dcrespo
22nd May 2013, 02:12
I have a QWidget MyWidget that instantiates a QDialog MyDialog by using its exec() method.



void MyWidget::execMyDialog()
{
// In another place I delete and null m_my_dialog
if( !m_my_dialog )
{
m_my_dialog = new MyDialog();
connect( m_my_dialog, SIGNAL(signalDataRequested())
m_data_provider, SLOT(requestData()) );
connect( m_data_provider, SIGNAL(signalDataIsAvailable(MyData*))
m_my_dialog, SLOT(setData(MyData*)) );
}
m_my_dialog->exec();
}

Under Windows XP 32bit SP3, signals are not caught by MyWidget, while under Linux it is. The idea is that while MyDialog is up, a user could press a button to ask for data to the backend, then the signal/slots mechanism would kick-in and return the data in the way explained above.

So, this points out that under Windows, exec does not allow anything to execute except the dialog itself. But under Linux, it does allow it. In both cases the dialog is modal though.

Any thoughts?

Thanks!

ChrisW67
22nd May 2013, 05:21
There is nothing in your code connecting any signal to the MyWidget instance.

Why are you using a signal/slot connection when you could pass m_data_provider directly into the dialog and have it make direct calls?

dcrespo
22nd May 2013, 15:31
Thanks for your response.

Sorry, I meant signals connected to MyDialog instead of MyWidget.

Thanks!