Results 1 to 3 of 3

Thread: Different behavior of QDialog::exec() under Windows and under Linux

  1. #1
    Join Date
    May 2010
    Posts
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Different behavior of QDialog::exec() under Windows and under Linux

    I have a QWidget MyWidget that instantiates a QDialog MyDialog by using its exec() method.

    Qt Code:
    1. void MyWidget::execMyDialog()
    2. {
    3. // In another place I delete and null m_my_dialog
    4. if( !m_my_dialog )
    5. {
    6. m_my_dialog = new MyDialog();
    7. connect( m_my_dialog, SIGNAL(signalDataRequested())
    8. m_data_provider, SLOT(requestData()) );
    9. connect( m_data_provider, SIGNAL(signalDataIsAvailable(MyData*))
    10. m_my_dialog, SLOT(setData(MyData*)) );
    11. }
    12. m_my_dialog->exec();
    13. }
    To copy to clipboard, switch view to plain text mode 

    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!

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,546
    Thanks
    13
    Thanked 1,578 Times in 1,507 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Different behavior of QDialog::exec() under Windows and under Linux

    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?

  3. #3
    Join Date
    May 2010
    Posts
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Different behavior of QDialog::exec() under Windows and under Linux

    Thanks for your response.

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

    Thanks!

Similar Threads

  1. QTcpsocket and QDialog::exec()
    By timewolf in forum Qt Programming
    Replies: 2
    Last Post: 25th August 2011, 08:27
  2. Replies: 9
    Last Post: 25th March 2011, 21:22
  3. QDialog.exec() exiting without calling QDialog::accept()
    By doggrant in forum Qt Programming
    Replies: 3
    Last Post: 2nd February 2011, 11:35
  4. QDialog problem with exec()
    By nomadscarecrow in forum Qt Programming
    Replies: 3
    Last Post: 23rd April 2010, 18:40
  5. Pre app.exec() behavior question
    By sgmurphy19 in forum Qt Programming
    Replies: 3
    Last Post: 15th September 2008, 22:02

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.