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. QProcess Try Catch

QProcess Try Catch

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 1.0k Views 1 Watching
  • 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.
  • jondoeJ Offline
    jondoeJ Offline
    jondoe
    wrote on last edited by
    #1

    I wanted use Try Catch for QProcess but dont working.

    try {
    QProcess *process = new QProcess(this);
    QString program = "myapp.exe";
    process->start(program);
    } catch (QProcess::ProcessError error) {
    qDebug() << error << " exe not found";
    }

    Why not working ? What i need use?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Because Qt doesn't throw exceptions.

      Use signals and slots, or the waitForXXX methods and the error method to get the information you want.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      jondoeJ 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        Because Qt doesn't throw exceptions.

        Use signals and slots, or the waitForXXX methods and the error method to get the information you want.

        jondoeJ Offline
        jondoeJ Offline
        jondoe
        wrote on last edited by
        #3

        @SGaist Thank you for answer. I still learning QT. Can u send me example please for my code ? How can i use signals and slots for my code ?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Did you read QProcess documentation ?

          You already have there several examples.

          As for signals and slots, you have a dedicated chapter here.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1

          • Login

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