[SOLVED] QProcess hell



  • Hi all,
    I'm trying to have something like this:

    • a REST service is handling requests in a thread per request
    • a Process Pool Manager (QObject child class) is responsible for starting processes, and storing processes output of finite kind of processes.
    • Request Handlers may use the Process Pool Manager (via queued signals) to start a process and get the process output.
    • To avoid the super nerves killing:
      @"QObject: Cannot create children for a parent that is in a different thread"@
      the Process Pool Manager is started in his own thread, processes are started only from this thread.

    At this point I've got this killing message #2 when trying to connect signals emitted from my QProcess(es) to my Process Pool Manager slots:
    @Warning: QObject::connect: Cannot queue arguments of type 'QProcess::ProcessError'@
    Ok, so I've try to add
    @
    Q_ENUMS(QProcess::ProcessError);
    Q_ENUMS(QProcess::ExitStatus);
    @
    in my Process Pool Manager Class declaration, but still have the message...
    Any clue?
    Thank you for your help.



  • You should read the QMetaType documentation...



  • [quote author="dword" date="1315839798"]At this point I've got this killing message #2 when trying to connect signals emitted from my QProcess(es) to my Process Pool Manager slots:[/quote]
    You most probably got this message:
    @
    QObject::connect: Cannot queue arguments of type 'QProcess::ProcessError'
    (Make sure 'QProcess::ProcessError' is registered using qRegisterMetaType().)
    @
    @
    ...
    qRegisterMetaTypeQProcess::ProcessError("QProcess::ProcessError");
    ...
    @



  • Thank you very much Lukas it worked just fine.
    @Andre: I did search and those are the first lines from my Qt documentation:

    bq. Registers the type name typeName for the type T. Returns the internal ID used by QMetaType. Any class or struct that has a public default constructor, a public copy constructor and a public destructor can be registered.

    So I don't see how, based on that, I can guess that it allows me to register an enum from another class. But maybe it's just my understanding...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.