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. Catching QProcess ExitStatus - how ?
QtWS25 Last Chance

Catching QProcess ExitStatus - how ?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 978 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.
  • M Offline
    M Offline
    motorsep
    wrote on last edited by
    #1

    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
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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
      0

      • Login

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