【发布时间】:2010-01-16 12:23:35
【问题描述】:
我正在使用 Qt 框架用 C++ 编写应用程序。 它应该通过 http 下载文件并使用 QProgressbar 显示下载进度 - 但我没有让这部分工作!
示例代码:
QProgressBar* pbar = new QProgressBar();
//calls the website and returns the QNetworkReply*
QNetworkReply* downloader = Downloader->getFile();
connect(downloader, SIGNAL(downloadProgress(qint64,qint64)), pbar, SLOT(setValue(int)));
如果我运行我的代码,会出现以下错误:
QObject::connect: Incompatible sender/receiver arguments
QNetworkReplyImpl::downloadProgress(qint64,qint64) --> QProgressBar::setValue(int)
但是the Qt docs for QNetworkReply 说:
该信号适用于连接QProgressBar::setValue(),更新提供用户反馈的QProgressBar。
我的代码有什么问题,如何让它工作? 我在 Linux 下运行 Qt 4.5.3。
感谢您的帮助,对不起我的英语!
【问题讨论】:
标签: c++ qt networking qt4