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. Can a Mac DynLib Spawn an Async QProcess?
QtWS25 Last Chance

Can a Mac DynLib Spawn an Async QProcess?

Scheduled Pinned Locked Moved General and Desktop
qprocessspawndynlib
4 Posts 2 Posters 1.7k 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
    maximo
    wrote on last edited by
    #1

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

      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
      0
      • SGaistS SGaist

        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.

        M Offline
        M Offline
        maximo
        wrote on last edited by
        #3

        @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
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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
          0

          • Login

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