summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-01-19 13:51:56 +0100
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-01-19 13:51:56 +0100
commit21cb8297c16cb8f700cabce68508665ca25066b0 (patch)
tree07b9a9d15f4591d0dcb9ced48da6e5bbabf9d32b /examples
parent633e5de268996306e444b37e05f703b4905a4ea9 (diff)
parent912cdbf15f46c9aa5b64bb76222b09065e8786be (diff)
Merge remote-tracking branch 'origin/5.4' into dev
Conflicts: .qmake.conf Change-Id: I7e707606f2caa18b6f4027aa5833b2d6d21511d4
Diffstat (limited to 'examples')
-rw-r--r--examples/bluetooth/chat/Search.qml3
-rw-r--r--examples/bluetooth/chat/chat.qml8
-rw-r--r--examples/bluetooth/chat/qmlchat.cpp6
3 files changed, 16 insertions, 1 deletions
diff --git a/examples/bluetooth/chat/Search.qml b/examples/bluetooth/chat/Search.qml
index 4557971b..47fbb6ab 100644
--- a/examples/bluetooth/chat/Search.qml
+++ b/examples/bluetooth/chat/Search.qml
@@ -41,7 +41,7 @@
import QtQuick 2.2
Rectangle {
- property bool animationRunning: ranimation.running
+ property bool animationRunning: true
function appendText(newText) {
searchText.text += newText
@@ -75,6 +75,7 @@ Rectangle {
duration: 2000
loops: Animation.Infinite
alwaysRunToEnd: true
+ running: animationRunning
}
}
diff --git a/examples/bluetooth/chat/chat.qml b/examples/bluetooth/chat/chat.qml
index 6614d53c..6a2830ad 100644
--- a/examples/bluetooth/chat/chat.qml
+++ b/examples/bluetooth/chat/chat.qml
@@ -57,10 +57,18 @@ Item {
//! [BtDiscoveryModel-1]
onRunningChanged : {
if (!btModel.running && top.state == "begin" && !serviceFound) {
+ searchBox.animationRunning = false;
searchBox.appendText("\nNo service found. \n\nPlease start server\nand restart app.")
}
}
+ onErrorChanged: {
+ if (error != BluetoothDiscoveryModel.NoError && !btModel.running) {
+ searchBox.animationRunning = false
+ searchBox.appendText("\n\nDiscovery failed.\nPlease ensure Bluetooth is available.")
+ }
+ }
+
//! [BtDiscoveryModel-2]
onServiceDiscovered: {
if (serviceFound)
diff --git a/examples/bluetooth/chat/qmlchat.cpp b/examples/bluetooth/chat/qmlchat.cpp
index aefc900a..6e23fe13 100644
--- a/examples/bluetooth/chat/qmlchat.cpp
+++ b/examples/bluetooth/chat/qmlchat.cpp
@@ -43,11 +43,17 @@
#include <QtQml/QQmlEngine>
#include <QtQml/QQmlContext>
#include <QDebug>
+#include <QBluetoothLocalDevice>
int main(int argc, char *argv[])
{
QGuiApplication application(argc, argv);
+ QList<QBluetoothHostInfo> infos = QBluetoothLocalDevice::allDevices();
+ if (infos.isEmpty())
+ qWarning() << "Missing Bluetooth local device. "
+ "Example will not work properly.";
+
const QString mainQmlApp = QLatin1String("qrc:/chat.qml");
QQuickView view;
view.setSource(QUrl(mainQmlApp));