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 Operation
QtWS25 Last Chance

QProcess Operation

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 1.4k 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.
  • S Offline
    S Offline
    sos1
    wrote on last edited by
    #1

    I want to run the touch screen calibration from my program. So, when the user hits the ts_calibrate button in my app, the calibration application should run and show its own screen. When the calibration is complete and the program terminates, execution should return to my app. My app should stall waiting for completion.

    I tried using QProcess but I get a segmentation fault. Here is the code.

    @void StartUp::on_ts_CalibrateButton_clicked()
    {
    QProcess *ts_calibrate;
    ts_calibrate->start("ts_calibrate");

    if (!ts_calibrate->waitForStarted())
    {
        qDebug() << "\nts_calibrate started";
    }
    
    if (!ts_calibrate->waitForFinished())
    {
        qDebug() << "ts_calibrate finished";
    }
    

    }@

    ts_calibrate runs fine from the command prompt. I don't need any data transfer between my app and the calibration program.

    What is the problem?

    Thanks,
    James

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      You need to initialise your process:
      @
      QProcess *ts_calibrate = new QProcess();
      @

      or just create it on a stack.

      (Z(:^

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sos1
        wrote on last edited by
        #3

        Thanks, that was a silly mistake.

        Now, it crashes with a "User defined signal 2" on line "waitForStarted()". It does start the process as shown below.

        @
        840 ? 00:00:00 kworker/0:1
        926 ? 00:00:00 ts_calibrate
        927 pts/0 00:00:00 ps
        root@dhcppc9:~#
        @

        What am I doing wrong? Will this do what I want?

        James

        1 Reply Last reply
        0
        • p3c0P Offline
          p3c0P Offline
          p3c0
          Moderators
          wrote on last edited by
          #4

          Can QProcess::execute() be useful ?

          157

          1 Reply Last reply
          0
          • sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #5

            It should work the way you do it now, assuming QProcess can find the binary to run.

            One correction: you are displaying qDebug() messages when the methods fail (exclamation mark at the beginning of the if expression).

            (Z(:^

            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