I am currently creating an application that will be able to display maps. Before I add more advanced features, I would like to simply display a map of a certain area in the application. For this I used a bit of modified code from the Qt example "Minimal map". Code in map.qml file:
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
}
}
I display the map using QQuickWidget with the source set to my QML file. Unfortunately, the map is not displayed. Only a gray background and the inscription appear in the QuickWidget (I attach a picture to the post). In the QML Debugger Console i got the messages:
"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'"
If your OS is windows you should install OpenSSL. and also you are using the osm plugin so you should be connected to the internet when Running the application.
your code in my system Runs like this :