QProcess im Thread
Verfasst: 25. Januar 2007 12:09
Hallo, ich versuche 2 mal QProcess in einem Thread nach einander auszuführen. Doch beim 2. mal kommt nur Fehler:
QObject: Cannot create children for a parent that is in a different thread.
QObject: Cannot create children for a parent that is in a different thread.
QObject::killTimer: timers cannot be stopped from another thread
QObject::startTimer: timers cannot be started from another thread
QObject::connect: Cannot queue arguments of type 'HANDLE'
(Make sure 'HANDLE' is registed using qRegisterMetaType().)
QObject::killTimers: timers cannot be stopped from another thread
Hier etwas Code wie das ganze läuft:
Wenn der 1. Prozess schief geht, wird alles wie geplant beenden. Wenn es jedoch gut geht und der 2. laufen soll, dann kracht es siehe oben.
Hat sowas schon mal jemand gemacht?
QObject: Cannot create children for a parent that is in a different thread.
QObject: Cannot create children for a parent that is in a different thread.
QObject::killTimer: timers cannot be stopped from another thread
QObject::startTimer: timers cannot be started from another thread
QObject::connect: Cannot queue arguments of type 'HANDLE'
(Make sure 'HANDLE' is registed using qRegisterMetaType().)
QObject::killTimers: timers cannot be stopped from another thread
Hier etwas Code wie das ganze läuft:
Code: Alles auswählen
run()
{
K_Prozess=new QProcess();
connect(K_Prozess,SIGNAL(finished(int)),this,SLOT(K_ProzessIstFertig(int)));
QStringList Argumente;
K_Prozess->start("bla",Argumente);
if(!K_Prozess->waitForStarted(5000))
{
K_Fehlercode=1;
K_Fehlermeldung=trUtf8("Das Werkzeug konnte nicht ausgeführt werden.");
emit fertig(this);
return;
}
K_Fehlercode=exec();
}
K_ProzessIstFertig(int rueckgabe)
{
if(rueckgabe!=0)
{
K_Fehlermeldung=Fehlermeldung;
exit(1);
}
else
{
K_Prozess->start("blaa",QStringList()<<"Parameter");
if(!K_Prozess->waitForStarted(5000))
{
K_Fehlercode=1;
K_Fehlermeldung=trUtf8("Das Werkzeug 2 konnte nicht ausgeführt werden.");
emit fertig(this);
exit(1);
return;
}
}
}
Hat sowas schon mal jemand gemacht?