我正在尝试通过REST请求向我们的Web服务发送请求。首先我只将finished(QNetworkReply*)
信号连接到一个插槽,但由于ssl问题,我也试图连接sslErrors(QNetworkReply*, const QList<QSslError>&)
插槽,因为它的请求是https,所以它永远不可能完成。无法从QNetworkAccessManager访问Ssl错误列表
connect(&_accessManager, SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError>&)),
this, SLOT(printSslErrors(QNetworkReply*, const QList<QSslError>&)));
然后在我的打印功能中,我无法以任何方式访问错误列表。
void AssetManager::printSslErrors(QNetworkReply *reply, const QList<QSslError>& errors) {
...
}
心中已经尝试:
const QSslError test = errors.at(0); // error on 'test'
QSslError test = errors.at(0); // error on 'test'
或
foreach(QSslError error, errors) {
qDebug() << error.errorString(); // error on 'errors'
}
for(int i = 0; i < errors.count(); i++) {
qDebug() << errors.at(i).errorString(); // error on 'errors'
}
这导致:
error C2079: 'test' uses undefined class 'QSslError'
error C2440: 'initializing' : cannot convert from 'const QSslError' to 'int'
或
error C2027: use of undefined type 'QSslError'
error C2228: left of '.toString' must have class/struct/union
还,智能感知强调errors
或test
与消息:
IntelliSense: incomplete type is not allowed
(请注意,当我这样做errors.count()
它不抱怨)
我包括在headerfile <QSslError>
...
我一直对sslError信号非常不满,几周前我甚至无法将信号连接到任何东西,因为它“不存在”。我是我错过了一个模块或什么?
感谢您的帮助
编辑:
仍然得到错误:
Object::connect: No such signal QNetworkAccessManager::sslErrors(QNetworkReply*, const QList&)
此外,不能检查,如果我有SSL
qDebug() << QSslSocket::supportsSsl();
由于QSslSocket是不确定的,甚至尽管它包含在内。它必须有一些重要的东西,我想在这里错过?我需要安装一些东西吗?我在这里完全地丧失:(
你知道如何构建它的Windows?看过这么多的指南,他们都是不同的...... – chikuba 2012-04-10 03:13:56