modal dialog called from QAction does not close until action terminates



  • Under Qt5.9:

    A QAction A is connected to a MainWindow member function f that executes a QFileDialog D, then takes quite a while to load the selected files. Against my intentions, the file dialog remains open until f terminates. Calling D.close() does not help. Letting D go out of scope does not help.

    My best hypothesis right now is that the unexpected behavior of D in f has to do with f being called from a QAction. Is this plausible, or even a known problem?



  • Add QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); after D.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().


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.