Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-94886

The callback function registered by IOServiceAddMatchingNotification is not called immediately if a modal dialog is shown

    XMLWordPrintable

Details

    • macOS

    Description

      I am using IOServiceAddMatchingNotification  to register a callback function that is called whenever USB device is connected/disconnected.

      Scenario A:
          * Test steps:
             1- Open the main window
             2- Open a dialog in front of main window via QDialog::Open() and NonModal
             3- Disconnect the USB device from PC
         * Test Result: The callback function is called immediately

      Scenario B:
          * Test steps:
             1- Open the main window
             2- Open a dialog in front of main window via QDialog::exec() or  QDialog::Open() and Modal
             3- Disconnect the USB device from PC

          * Test Result: The callback function is NOT called immediately. The callback function is only called after the dialog is closed.

      Is it possible to make callback function is called immediately when the dialog is opened in modal mode?

      How to reproduce
      1. Use QTBUG-94886.zip
      2. Click "Show Modal Dialog" button to open a modal dialog
      3. Connect/disconnect USB devices

      Expected behavior
      The text label is changed to Device Removed or Device Connected.

      Actual behavior
      The text label doesn't change.

      What is known

      • Everything works fine with non-modal dialog.
        --> Try "Show Non Modal Dialog " instead in the reproducible process.
      • If the signal is e.g. QTimer::timeout, the slot is called immediately.
            QObject::connect(timer, &QTimer::timeout, this, &ModalDialog::changeTextConnected, Qt::ConnectionType::QueuedConnection);
            timer->start(3000);
        

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            srutledg Shawn Rutledge
            tam Tam Tran
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes