Details
-
Bug
-
Resolution: Out of scope
-
P2: Important
-
None
-
6.0.1, 6.2.0 Beta3
-
Build Environment: iMac, Catalina, Qt6,0,1
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);