Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Catching QProcess ExitStatus - how ?

    General and Desktop
    2
    2
    794
    Loading More Posts
    • 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.
    • M
      motorsep last edited by

      I am quite new to Qt5 and C++, and I am making a basic app launcher for desktop Windows/Linux.

      I got very basic functionality done yesterday, namely Start button starts .exe file, and Quit button quits launcher.

      Now I need to go a bit further and do the following. I need to check for process, and if it's still running, pressing Quit button would pop a new window saying "Your app is still running, please shut it down first" and Ok button, pressing which goes back to launcher's main window.

      Then I need to have a check for process exit status, and if it shuts down normally, quit launcher automatically.

      How do I do that? (I used QtDesigner to make UI, so the code in mainwindow.cpp is quite short, if it's relevant)

      Thanks!

      1 Reply Last reply Reply Quote 0
      • Chris Kawa
        Chris Kawa Moderators last edited by

        Whenever processs finishes QProcess emits a signal "finished()":http://qt-project.org/doc/qt-5/qprocess.html#finished. It indicates the exit status and app exit code.

        You can also check if the process is still running with "state()":http://qt-project.org/doc/qt-5/qprocess.html#state

        1 Reply Last reply Reply Quote 0
        • First post
          Last post