你好,我是学习QT,并试图上传使用QFtp文件我写了如下因素代码QT(QFtp)问题
this->connect(this->ftp, SIGNAL(done(bool)), this, SLOT(ftpDone(bool)));
this->connect(this->ftp, SIGNAL(dataTransferProgress(qint64, qint64)), this, SLOT(dataTransferProgress(qint64, qint64)));
this->connect(this->ftp, SIGNAL(stateChanged(int)), this, SLOT(stateChanged(int)));
.....
if(this->file.open(QIODevice::ReadWrite))
{
this->ftp->setTransferMode(QFtp::Active);
this->ftp->connectToHost(this->settings->getHost());
this->ftp->login(this->settings->getUser(), this->settings->getPassword());
this->ftp->cd(remoteFilePath);
this->ftp->get(this->fileName, &this->file);
this->ftp->close();
}
和它种停靠它在dataTransferProgress中报告它在0/XXX处,但是从不再次调用该插槽(使用相同的代码,但使用get函数,我可以下载文件并且工作没有问题)也是在超时之后得到的错误是QFtp :: UnknownError。
我有一个非常类似的问题与你的,花很多时间就可以了。这是我学到的最宝贵的东西:你应该习惯Qt风格的编程,即尽可能使事件驱动和面向对象。你会很高兴=) – kolistivra 2010-06-06 23:32:35