It looks as if their was a solution for this in qt3, but I cannot find one for qt4 (all I have used, goggling I saw solutions for qt3).
看起来好像他们是qt3中的一个解决方案,但是我找不到qt4的解决方案(我所使用的,我看到了qt3的解决方案)。
connect(r, SIGNAL(readyReadStandardError()), this, SLOT(updateError()));
connect(r, SIGNAL(readyReadStandardOutput()), this, SLOT(updateText()));
connect(r, SIGNAL(finished(int exitcode)), this, SLOT(updateExit()));
I have my stdout/stderr SIGNAL/SLOT's working just fine, but I cannot seem to find a good solution for finished. I cannot do anything in a loop or proc->waitforfinished because I need constant updated to my UI. How can I do this?
我的stdout/stderr信号/插槽工作得很好,但是我似乎找不到一个好的解决方案。我不能在循环或proc->waitforfinished中执行任何操作,因为我需要不断更新我的UI。我该怎么做呢?
My error: Object::connect: No such signal QProcess::finished(int exitcode)
我的错误:对象::::connect:没有这样的信号QProcess:::finished(int exitcode)
Thanks
谢谢
Below are the SIGNALS for QProcess....
下面的信号QProcess ....
Signals
void error ( QProcess::ProcessError error )
void finished ( int exitCode, QProcess::ExitStatus exitStatus )
void readyReadStandardError ()
void readyReadStandardOutput ()
void started ()
void stateChanged ( QProcess::ProcessState newState )
2 个解决方案
#1
2
replace your code line
取代你的代码行
connect(r, SIGNAL(finished(int exitcode)), this, SLOT(updateExit()));
with
与
connect(r, SIGNAL(finished(int)), this, SLOT(updateExit()));
When connection signals and slots dont give a parameter name.
当连接信号和插槽没有给出参数名称时。
#2
0
I feel like I'm missing something here, but I have a few minutes... :)
我觉得我错过了一些东西,但我有几分钟……:)
What's wrong with the finished signal in 4.x? It just adds a few parameters to what you have from what I can tell.
4.x中完成的信号有什么问题?它只是添加了一些参数,根据我所知道的。
4.5:
4.5:
void QProcess::finished( int exitCode, QProcess::ExitStatus exitStatus )
4.0:
4.0:
void QProcess::finished( int exitCode )
Change your slot to have the correct arguments and just ignore them if you don't need them.
更改您的位置以获得正确的参数,如果不需要,则忽略它们。
As for needing status updates, launch the new QProcess in a separate thread and let that thread do the waiting.
至于需要状态更新,请在单独的线程中启动新的QProcess,并让该线程进行等待。
#1
2
replace your code line
取代你的代码行
connect(r, SIGNAL(finished(int exitcode)), this, SLOT(updateExit()));
with
与
connect(r, SIGNAL(finished(int)), this, SLOT(updateExit()));
When connection signals and slots dont give a parameter name.
当连接信号和插槽没有给出参数名称时。
#2
0
I feel like I'm missing something here, but I have a few minutes... :)
我觉得我错过了一些东西,但我有几分钟……:)
What's wrong with the finished signal in 4.x? It just adds a few parameters to what you have from what I can tell.
4.x中完成的信号有什么问题?它只是添加了一些参数,根据我所知道的。
4.5:
4.5:
void QProcess::finished( int exitCode, QProcess::ExitStatus exitStatus )
4.0:
4.0:
void QProcess::finished( int exitCode )
Change your slot to have the correct arguments and just ignore them if you don't need them.
更改您的位置以获得正确的参数,如果不需要,则忽略它们。
As for needing status updates, launch the new QProcess in a separate thread and let that thread do the waiting.
至于需要状态更新,请在单独的线程中启动新的QProcess,并让该线程进行等待。