你好,我是學習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