QML 映射 - TLS 初始化失败错误

QML map - TLS initialization failed ERROR

我目前正在创建一个能够显示地图的应用程序。在添加更多高级功能之前,我想在应用程序中简单地显示某个区域的地图。为此,我使用了一些来自 Qt 示例“最小地图”的修改代码。 map.qml 文件中的代码:

import QtQuick 2.0
import QtLocation 5.6
import QtPositioning 5.6

Rectangle {
    Plugin {
        id: mapPlugin
        name: "osm" // "mapboxgl", "esri", ...
        // specify plugin parameters if necessary
        // PluginParameter {
        //     name:
        //     value:
        // }
    }

    Map {
        anchors.fill: parent
        plugin: mapPlugin
        center: QtPositioning.coordinate(59.91, 10.75) // Oslo
        zoomLevel: 14
    }
}

我使用 QQuickWidget 显示地图,并将源设置为我的 QML 文件。不幸的是,地图没有显示。 QuickWidget 中只出现灰色背景和文字(我在 post 上附上了一张图片)。在 QML 调试器控制台中,我收到消息:

"QObject:​:​connect(​QQuickWindow,​ QDeclarativeGeoMap)​:​ invalid nullptr parameter"

"QGeoTileProviderOsm:​ Tileserver disabled at QUrl(​"​http:​/​/​maps-​redirect.​qt.​io/​osm/​5.​8/​satellite"​)​"

"QGeoTileFetcherOsm:​ all providers resolved"

"QSslSocket:​:​connectToHostEncrypted:​ TLS initialization failed"

"QGeoTileRequestManager:​ Failed to fetch tile (​8682,​4766,​14)​ 5 times,​ giving up.​ Last error message was:​ '​TLS initialization failed'​"

如果您的 OS 是 windows,您应该安装 OpenSSL。 而且你正在使用 osm 插件,所以你应该在 运行 应用程序时连接到互联网。

你的代码在我的系统中是这样运行的: