Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Problem SSL Google Maps QWebview



  • Hi everyone,

    I'm progamming a QWebView so as to display a local HTML file. This webpage is divided in an HTML part and a javascript one in order to display a Google Map. This HTML file is fine, it gives me the right result on Firefox. Nervetheless, when i put it in my QWebView, the map layer is ok but my custom overlays representing pie charts are gone. Moreover, I've got these errors in the console tab :

    @QSslSocket: cannot call unresolved function SSLv23_client_method
    QSslSocket: cannot call unresolved function SSL_CTX_new
    QSslSocket: cannot call unresolved function SSL_library_init
    QSslSocket: cannot call unresolved function ERR_get_error
    QSslSocket: cannot call unresolved function ERR_get_error
    LEAK: 58 CachedResource
    LEAK: 294 WebCoreNode@

    I'm aware that it is a SSL issue, but after many searches on Google I just can't manage to make my QwebView works. I've downloaded OpenSSL light version, even the complete one. I've put libeay32.dll, libssl32.dll and ssleay32.dll near my .exe file in my debug folder, but nothing happens. I've even copy all the dll files needed so as to launch my exe from the debug folder, nothing happens too.

    If someone could give me a clear method to add SSL, it could be awesome. I've lost many hours (days ?) on it.

    I'm on Qt 5.2.1, this is the standard code I'm using, maybe it could give you some clues.

    @#include <QtGui>

    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);
    ui->gmapView->settings()->setAttribute(QWebSettings::JavascriptEnabled, true );
    ui->gmapView->settings()->setAttribute(QWebSettings::PluginsEnabled,true);
    ui->gmapView->settings()->setAttribute(QWebSettings::JavaEnabled,true );
    ui->gmapView->settings()->setAttribute(QWebSettings::JavascriptEnabled,true );
    ui->gmapView->settings()->setAttribute(QWebSettings::AutoLoadImages,true);
    ui->gmapView->settings()->setAttribute(QWebSettings::PrivateBrowsingEnabled,false);
    ui->gmapView->settings()->setAttribute(QWebSettings::DnsPrefetchEnabled,true);
    ui->gmapView->settings()->setAttribute(QWebSettings::JavascriptCanAccessClipboard,true);
    ui->gmapView->settings()->setAttribute(QWebSettings::PrintElementBackgrounds,true);
    ui->gmapView->settings()->setAttribute(QWebSettings::LocalStorageDatabaseEnabled,true);

    QString fileName = qApp->applicationDirPath() + "/map.html";
    if( !QFile&#40;fileName&#41;.exists() ) {
        qDebug() << "File not found:" << fileName;
    }
    
    QUrl url = QUrl::fromLocalFile&#40; fileName &#41;;
    ui->gmapView->load( url );
    

    }

    MainWindow::~MainWindow()
    {
    delete ui;
    }@

    .pro file

    @QT += core gui webkit webkitwidgets network sql svg xml

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = carte
    TEMPLATE = app

    CONFIG += openssl-linked
    CONFIG += openssl

    SOURCES += main.cpp
    mainwindow.cpp

    HEADERS += mainwindow.h

    FORMS += mainwindow.ui@

    Firefox result :

    http://hpics.li/c1cbdf5

    Qt result :

    http://hpics.li/383c9ab

    Thanks a lot





  • After reading this post, I've added this to my .pro

    @INCLUDEPATH += C:/GnuWin32/include

    LIBS += -L C:/GnuWin32/lib -llibeay32 -llibssl32 -lcrypto -lssl@

    and I've made a copy of SSL dll in Windows system folder, but I still have the errors.



  • Do you know if I have to compile something or just linking librairies and copy dll so as to enable SSL support ?

    @QSslSocket::supportsSsl();@

    This line gives me a false answer.

    I'm in QT 5.1.1, with the last OpenSSL-Win64.


Log in to reply