diff options
author | Paolo Angelelli <paolo.angelelli@qt.io> | 2019-03-14 13:52:33 +0100 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@qt.io> | 2019-03-25 14:17:18 +0000 |
commit | 5c3e3464c2ccf960ef3aaee4286f3d5b4cde12ac (patch) | |
tree | 1eb0558a758bb96c5dfb3c51513889600ae08c8b /examples/location | |
parent | 0af21b1f95180949f75ee2933d4147f610a29b6b (diff) | |
download | qtlocation-5c3e3464c2ccf960ef3aaee4286f3d5b4cde12ac.tar.gz |
Display a notice when requesting a SSL map type without SSL support
Some plugins request map data for some map types over HTTPS.
Without SSL support (Qt built without SSL support, or missing OpenSSL
libraries) this typically translates into blank maps.
This is very evident on the MapViewer example.
This patch makes sure that the example displays a notice when this
situation happens.
[ChangeLog] Added a notice to the
MapViewer example to inform when a HTTPS-based map is selected without
SSL support.
Change-Id: I85428bb0536f33089a0e6045301c089fafe69d74
Fixes: QTBUG-74195
Fixes: QTBUG-74294
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'examples/location')
-rw-r--r-- | examples/location/mapviewer/main.cpp | 3 | ||||
-rw-r--r-- | examples/location/mapviewer/mapviewer.qml | 13 |
2 files changed, 16 insertions, 0 deletions
diff --git a/examples/location/mapviewer/main.cpp b/examples/location/mapviewer/main.cpp index 73bc937b..39c117ed 100644 --- a/examples/location/mapviewer/main.cpp +++ b/examples/location/mapviewer/main.cpp @@ -52,6 +52,8 @@ #include <QtGui/QGuiApplication> #include <QtQml/QQmlApplicationEngine> #include <QtQuick/QQuickItem> +#include <QSslSocket> +#include <QQmlContext> static bool parseArgs(QStringList& args, QVariantMap& parameters) { @@ -131,6 +133,7 @@ int main(int argc, char *argv[]) parameters[QStringLiteral("osm.useragent")] = QStringLiteral("QtLocation Mapviewer example"); QQmlApplicationEngine engine; + engine.rootContext()->setContextProperty("supportsSsl", QSslSocket::supportsSsl()); engine.addImportPath(QStringLiteral(":/imports")); engine.load(QUrl(QStringLiteral("qrc:///mapviewer.qml"))); QObject::connect(&engine, SIGNAL(quit()), qApp, SLOT(quit())); diff --git a/examples/location/mapviewer/mapviewer.qml b/examples/location/mapviewer/mapviewer.qml index e97076ab..e8b016aa 100644 --- a/examples/location/mapviewer/mapviewer.qml +++ b/examples/location/mapviewer/mapviewer.qml @@ -429,6 +429,19 @@ ApplicationWindow { focus: true initialItem: Item { id: page + + Text { + visible: !supportsSsl && map && map.activeMapType && activeMapType.metadata.isHTTPS + text: "The active map type\n +requires (missing) SSL\n +support" + horizontalAlignment: Text.AlignHCenter + font.pixelSize: appWindow.width / 12 + font.bold: true + color: "grey" + anchors.centerIn: parent + z: 12 + } } function showMessage(title,message,backPage) |