Skip to content

Commit ae6ea2e

Browse files
committed
Ensure pending Qt events are processed before dialog closure in exec_dialog for cleaner lifecycle in automated tests
1 parent 09cdf92 commit ae6ea2e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

guidata/qthelpers.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,10 @@ def exec_dialog(dlg: QW.QDialog) -> int:
720720
int: Dialog exit code
721721
"""
722722
if execenv.unattended:
723+
# Important: process all pending Qt events before scheduling dialog closure.
724+
# This avoids side-effects between tests (timers, widgets) and ensures
725+
# clean dialog lifecycle in non-interactive automated test environments.
726+
QW.QApplication.processEvents()
723727
QC.QTimer.singleShot(
724728
execenv.delay,
725729
lambda: close_dialog_and_quit(dlg, screenshot=execenv.screenshot),

0 commit comments

Comments
 (0)