QFtp编程模型(二)

QFtp的list 命令 发射 listInfo信号,

执行序列

list ->commandStared

listInfo(file1)

listInfo(file2)

...

commandFinished

可以在commandStarted/Finished中监控 commandid 识别命令执行。

但是 执行get命令中 地一个get启动时发射 commandstart 得到 commandid=QFt::get

但是每个get执行后检测不到commandfinished中 commandid==QFT:get 命令

只在最后一个get执行后,监控到 commandfinished中的 commandid==QFTP::get命令

原因:见以下链接

https://stackoverflow.com/questions/23698520/qftp-get-never-emits-commandfinished

I am too late to reply, but it still may help others.

In void Ftp::commandFinished(int i, bool error) it is always better to check for QFtp::None option also, since if your last command is get and when commandFinished() slot gets called then if (ftp->currentCommand() == QFtp::Get) will not be able to identify the last command, since your current command may not be get because it is already finished.

You can also check with id as if(ftp->currentCommand() == QFtp::Get || 1 == id)

commandfiished 发送的过早,没有捕捉到 命令号。但可以在ftp->currenCommand==QFtp::Get 得到 该消息

原文地址:https://www.cnblogs.com/keleman/p/14187916.html