Solved modal dialog called from QAction does not close until action terminates
-
Under Qt5.9:
A QAction
A
is connected to a MainWindow member functionf
that executes a QFileDialogD
, then takes quite a while to load the selected files. Against my intentions, the file dialog remains open untilf
terminates. CallingD.close()
does not help. LettingD
go out of scope does not help.My best hypothesis right now is that the unexpected behavior of
D
inf
has to do withf
being called from a QAction. Is this plausible, or even a known problem? -
Add
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
afterD.close()
-
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
has no effect, the problem persists.
Anyway, I was wrong about QAction. The problem also persists if I directly call
mainwin->f
. -
can you please show your code?
-
What helps is
mainwin->repaint()
.