首页 > 其他分享> > qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed; QML Image: TLS
qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed; QML Image: TLS
作者:互联网
1.打印是否支持OpenSSL的版本
qDebug() << "OpenSSL支持情况:" << QSslSocket::supportsSsl();
2.打印openSSL版本
qDebug()<<"QSslSocket="<<QSslSocket::sslLibraryBuildVersionString();
3.显示结果
OpenSSL支持情况: false QSslSocket= "OpenSSL 1.1.1d 10 Sep 2019"
4.解决方法
我的原因是协议问题,在浏览器复制的链接为https打头,改成http请求即可。
Rectangle{ width: 480; height: 320; color: "#121212"; BusyIndicator{ id: busy; running: true; anchors.centerIn: parent; z:2; } Text { id: stateLabel; visible: false; anchors.centerIn: parent; z:3; } Image { id: imageViewer; asynchronous: true; cache: false; anchors.fill: parent; fillMode: Image.PreserveAspectFit; onStatusChanged: { if(imageViewer.states === Image.Loading){ busy.running = true; stateLabel.visible = true; stateLabel.text = "LOADING......"; console.log("LOADING......"); }else if(imageViewer.states === Image.Ready){ busy.running = false; stateLabel.text = "READY"; console.log("READY......"); }else if(imageViewer.states === Image.Error){ busy.running = false; stateLabel.visible = true; stateLabel.text = "ERROR"; console.log("ERROR......"); } } } Component.onCompleted: { //imageViewer.source = "https://pics7.baidu.com/feed/7a899e510fb30f243d0ac7db997a284aaf4b034a.jpeg?token=cd973842bc1e581afa288eb60689a24a"; //错误 imageViewer.source = "http://pics7.baidu.com/feed/7a899e510fb30f243d0ac7db997a284aaf4b034a.jpeg?token=cd973842bc1e581afa288eb60689a24a"; //Qt中只能使用http请求 } }
标签:TLS,busy,false,stateLabel,imageViewer,initialization,failed,true,Image 来源: https://www.cnblogs.com/xian-yongchao/p/15966966.html