QT多线程sign/slots问题
在新线程里QTime和http请求不能用sign/slots机制,请问大家该怎么实现
1.
void newThread::run()
{
QTimer *timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(downloadReadyRead()));
timer->start(5000);
}
void newThread::downloadReadyRead()
{
}
无法触发slot
2.
QUrl url("http://localhost/Default.aspx");
QNetworkRequest request(url);
currentDownload = manager.get(request);
connect(currentDownload, SIGNAL(downloadProgress(qint64,qint64)),
SLOT(downloadProgress(qint64,qint64)));
connect(currentDownload, SIGNAL(finished()),this,
SLOT(downloadFinished()));
connect(currentDownload, SIGNAL(readyRead()),this,
SLOT(downloadReadyRead()));
新线程里也无法触发slot,qt的线程机制有点没看懂,请大家帮忙