Qt Forum

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

    Can a Mac DynLib Spawn an Async QProcess?

    General and Desktop
    qprocess spawn dynlib
    2
    4
    1316
    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
      maximo last edited by

      Can a Mac dynlib spawn an async QProcess? Here's my trouble:

      • The examples I see on the web show this called from a GUI, and therefore they pass a "this" object on the "new QProcess(this)" call. That doesn't seem to work from a dynlib that isn't a GUI. What do I pass instead?

      • How do I keep a private handle variable on the class for the QProcess so that other functions can use that private variable?

      • This QProcess can take awhile to run (the command line takes awhile). How do I peek into standard output and standard error from it occasionally without doing blocking that locks up the dynlib? How do I know that the process has completed?

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        QProcess is part of QtCore. The parent can be any QObject or even 0 as long as you handle it's deletion properly.

        What private variable do you have in mind ?

        You have the link readyReadStandardError and readyReadStandardOutput to get data from your QProcess and the finished signal to know when it's done.

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

        M 1 Reply Last reply Reply Quote 0
        • M
          maximo @SGaist last edited by

          @SGaist said:

          Hi,

          QProcess is part of QtCore. The parent can be any QObject or even 0 as long as you handle it's deletion properly.

          What private variable do you have in mind ?

          The QProcess that I spawned. You also remind me -- when done, I need to use the "delete" statement on it so that I don't have a memory leak.

          You have the link readyReadStandardError and readyReadStandardOutput to get data from your QProcess and the finished signal to know when it's done.

          How do I connect those signals asynchronously within the Macintosh .dynlib file that I coded?

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            Creating a shared library on OS X using Qt follows the same rules as creating an application. You don't have special handling to do. Create your classes like you would for your application.

            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 Reply Quote 0
            • First post
              Last post