QWebView,如何访问https协议网页? [英] QWebView, how to access https protocol WebPage?

查看:99
本文介绍了QWebView,如何访问https协议网页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的平台:win32、QtSDK 2.4.1、MingW32、qt 4.7.我想通过 QWebView 访问 Https 协议网页,我该怎么做,我已经下载了 openssl 二进制文件并设置了它,但 QWebView 也不起作用,怎么办是错的?我需要编译 Qt 源代码并配置 -openssl?

My platform: win32, QtSDK 2.4.1, MingW32, qt 4.7. I want to access Https protocol webpage by QWebView, how can i do that, i had download the openssl binary, and setup it, but QWebView doesn't work also, what is wrong? i needed to compile Qt source code and configure -openssl?

#include<QApplication>
#include<QtWebKit/QWebView>
#include<QUrl>

int main(int argc, char* argv[])
{
    QApplication app(argc, argv);

    QWebView view;
    view.setUrl(QUrl("https://webim.feixin.10086.cn/"));
    view.show();

    return app.exec();
}

推荐答案

如果 Qt 是在不参考 openssl 的情况下构建的,它将无法访问任何 https 站点,这取决于 Qt 最初如何安装在您的机器上.

If Qt has been built without reference to openssl it won't be able to access any https sites, it depends on how Qt was installed on your machine initially.

您可以通过以下方式检查 ssl 支持:QSslSocket::supportsSsl你的程序,很可能没有它就可以构建.确保 Qt 配置过程知道 ssl 库的位置并从那里重建它.

You can check ssl support with: QSslSocket::supportsSsl in your program, chances are it'll have built without it. Make sure the Qt configure process is aware of where the ssl libraries are and rebuild it from there.

这篇关于QWebView,如何访问https协议网页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆