Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. modal dialog called from QAction does not close until action terminates

modal dialog called from QAction does not close until action terminates

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 664 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Joachim W
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      Add QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); after D.close()

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      1
      • J Offline
        J Offline
        Joachim W
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #4

          can you please show your code?

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          1 Reply Last reply
          0
          • J Offline
            J Offline
            Joachim W
            wrote on last edited by
            #5

            What helps is mainwin->repaint().

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved