diff options
author | Alex Blasche <alexander.blasche@qt.io> | 2017-06-21 09:20:56 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@qt.io> | 2017-06-22 12:49:36 +0000 |
commit | aae4768483839a3189bd32f7d44a86905ecb3e5b (patch) | |
tree | a92c609795aaac07655bf6ac7dac32fae930839f /examples/bluetooth/chat/qmlchat.cpp | |
parent | 71f22ac56c744ed71ccc26423a9c7a08fc4eb4e6 (diff) |
Adjust qml chat example to workaround required to Android SDP bug
Task-number: QTBUG-61542
Task-number: QTBUG-61392
Change-Id: Iff5c827d7ebb96dd29bc80f444d03804eddf405b
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'examples/bluetooth/chat/qmlchat.cpp')
-rw-r--r-- | examples/bluetooth/chat/qmlchat.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/examples/bluetooth/chat/qmlchat.cpp b/examples/bluetooth/chat/qmlchat.cpp index 8cd90bda..c6ff6341 100644 --- a/examples/bluetooth/chat/qmlchat.cpp +++ b/examples/bluetooth/chat/qmlchat.cpp @@ -44,9 +44,14 @@ #include <QtQml/QQmlContext> #include <QDebug> #include <QBluetoothLocalDevice> +#include <QtCore/QLoggingCategory> +#ifdef Q_OS_ANDROID +#include <QtAndroidExtras/QtAndroid> +#endif int main(int argc, char *argv[]) { + //QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true")); QGuiApplication application(argc, argv); QList<QBluetoothHostInfo> infos = QBluetoothLocalDevice::allDevices(); @@ -56,6 +61,19 @@ int main(int argc, char *argv[]) const QString mainQmlApp = QLatin1String("qrc:/chat.qml"); QQuickView view; + +#ifdef Q_OS_ANDROID + //workaround for Android's SDP discovery bug (see QTBUG-61392) + QString uuid; + if (QtAndroid::androidSdkVersion() >= 23) + uuid = QStringLiteral("c8e96402-0102-cf9c-274b-701a950fe1e8"); + else + uuid = QStringLiteral("e8e10f95-1a70-4b27-9ccf-02010264e9c8"); +#else + const QString uuid(QStringLiteral("e8e10f95-1a70-4b27-9ccf-02010264e9c8")); +#endif + + view.engine()->rootContext()->setContextProperty(QStringLiteral("targetUuid"), uuid); view.setSource(QUrl(mainQmlApp)); view.setResizeMode(QQuickView::SizeRootObjectToView); // Qt.quit() called in embedded .qml by default only emits |