summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@digia.com>2013-09-25 18:14:12 +0200
committerAlex Blasche <alexander.blasche@digia.com>2014-09-30 14:04:54 +0200
commit8be9bf4cead6f3a5bbdac3c01a2e3aa5d28f170c (patch)
treeeaab5f467277c4bbd202bd3fb7292f198ddfb349 /examples
parenta5c945cb4a55b4e9ec02f0674a37e529bc1bf7c2 (diff)
New QML based Bt chat client
Change-Id: I235c54591dbbf04aa58c024093beca8c068b4aed Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/bluetooth/bluetooth.pro3
-rw-r--r--examples/bluetooth/btchat/chat.cpp1
-rw-r--r--examples/bluetooth/chat/Button.qml104
-rw-r--r--examples/bluetooth/chat/InputBox.qml116
-rw-r--r--examples/bluetooth/chat/Search.qml93
-rw-r--r--examples/bluetooth/chat/chat.pro16
-rw-r--r--examples/bluetooth/chat/chat.qml194
-rw-r--r--examples/bluetooth/chat/chat.qrc13
-rw-r--r--examples/bluetooth/chat/images/background.jpgbin0 -> 36473 bytes
-rw-r--r--examples/bluetooth/chat/images/clear.pngbin0 -> 429 bytes
-rw-r--r--examples/bluetooth/chat/images/default.pngbin0 -> 4738 bytes
-rw-r--r--examples/bluetooth/chat/images/lineedit-bg-focus.pngbin0 -> 526 bytes
-rw-r--r--examples/bluetooth/chat/images/lineedit-bg.pngbin0 -> 426 bytes
-rw-r--r--examples/bluetooth/chat/qmlchat.cpp61
14 files changed, 600 insertions, 1 deletions
diff --git a/examples/bluetooth/bluetooth.pro b/examples/bluetooth/bluetooth.pro
index 4576956f..a98bb62d 100644
--- a/examples/bluetooth/bluetooth.pro
+++ b/examples/bluetooth/bluetooth.pro
@@ -9,4 +9,5 @@ qtHaveModule(quick): SUBDIRS += scanner \
picturetransfer \
pingpong \
lowenergyscanner \
- heartlistener
+ heartlistener \
+ chat
diff --git a/examples/bluetooth/btchat/chat.cpp b/examples/bluetooth/btchat/chat.cpp
index f3df7aa1..61943ac0 100644
--- a/examples/bluetooth/btchat/chat.cpp
+++ b/examples/bluetooth/btchat/chat.cpp
@@ -217,5 +217,6 @@ void Chat::sendClicked()
void Chat::showMessage(const QString &sender, const QString &message)
{
ui->chat->insertPlainText(QString::fromLatin1("%1: %2\n").arg(sender, message));
+ ui->chat->ensureCursorVisible();
}
//! [showMessage]
diff --git a/examples/bluetooth/chat/Button.qml b/examples/bluetooth/chat/Button.qml
new file mode 100644
index 00000000..be083193
--- /dev/null
+++ b/examples/bluetooth/chat/Button.qml
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the QtBluetooth module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+
+Rectangle {
+ // Identifier of the item
+ id: button
+
+ // Attaches to the Text element's text content
+ property string label
+ property color textColor: buttonLabel.color
+
+ // The color highlight when the mouse hovers on the rectangle
+ //property color onHoverColor: "lightsteelblue"
+ property color onHoverColor: "black"
+ property color borderColor: "transparent"
+
+ // buttonColor is set to the button's main color
+ property color buttonColor: "lightblue"
+
+ // Set appearance properties
+ radius: 6
+ antialiasing: true
+ border.width: 2
+ border.color: borderColor
+ height: buttonLabel.height * 1.3
+ width: buttonLabel.width * 1.3
+
+ Text {
+ id: buttonLabel
+ anchors.centerIn: parent
+ text: label // Bind the text to the parent's text
+ color: "black"
+ font.pixelSize: 24
+ }
+
+ // buttonClick() is callable and a signal handler,
+ // onButtonClick is automatically created
+ signal buttonClick()
+
+ // Define the clickable area to be the whole rectangle
+ MouseArea {
+ id: buttonMouseArea
+ anchors.fill: parent // Stretch the area to the parent's dimension
+ onClicked: buttonClick()
+
+ // If true, then onEntered and onExited called if mouse hovers in the mouse area
+ // If false, a button must be clicked to detect the mouse hover
+ hoverEnabled: true
+
+ // Display a border if the mouse hovers on the button mouse area
+ onEntered: parent.border.color = onHoverColor
+ //Remove the border if the mouse exits the button mouse area
+ onExited: parent.border.color = borderColor
+ }
+
+ // Change the color of the button when pressed
+ color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor
+ // Animate the color whenever the color property changes
+ Behavior on color { ColorAnimation { duration: 55 } }
+
+ // Scale the button when pressed
+ scale: buttonMouseArea.pressed ? 1.1 : 1.0
+ // Animate the scale property change
+ Behavior on scale { NumberAnimation { duration: 55 } }
+}
diff --git a/examples/bluetooth/chat/InputBox.qml b/examples/bluetooth/chat/InputBox.qml
new file mode 100644
index 00000000..8e21f79d
--- /dev/null
+++ b/examples/bluetooth/chat/InputBox.qml
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the QtBluetooth module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+
+FocusScope {
+ id: focusScope
+ width: 250; height: 28
+
+ property string text: textInput.text
+ signal clear
+
+ onClear: {
+ textInput.text=""
+ }
+
+ BorderImage {
+ source: "images/lineedit-bg.png"
+ width: parent.width; height: parent.height
+ border { left: 4; top: 4; right: 4; bottom: 4 }
+ }
+
+ BorderImage {
+ source: "images/lineedit-bg-focus.png"
+ width: parent.width; height: parent.height
+ border { left: 4; top: 4; right: 4; bottom: 4 }
+ visible: parent.activeFocus ? true : false
+ }
+
+ Text {
+ id: typeSomething
+ anchors.fill: parent; anchors.leftMargin: 8
+ verticalAlignment: Text.AlignVCenter
+ text: "Type something..."
+ color: "gray"
+ font.italic: true
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { focusScope.focus = true; }
+ }
+
+ TextInput {
+ id: textInput
+ anchors { left: parent.left; leftMargin: 8; right: clear.left; rightMargin: 8; verticalCenter: parent.verticalCenter }
+ focus: true
+ selectByMouse: true
+ }
+
+ Image {
+ id: clear
+ anchors { right: parent.right; rightMargin: 8; verticalCenter: parent.verticalCenter }
+ source: "images/clear.png"
+ opacity: 0
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { textInput.text = ''; focusScope.focus = true; }
+ }
+ }
+
+ states: State {
+ name: "hasText"; when: textInput.text != ''
+ PropertyChanges { target: typeSomething; opacity: 0 }
+ PropertyChanges { target: clear; opacity: 1 }
+ }
+
+ transitions: [
+ Transition {
+ from: ""; to: "hasText"
+ NumberAnimation { exclude: typeSomething; properties: "opacity" }
+ },
+ Transition {
+ from: "hasText"; to: ""
+ NumberAnimation { properties: "opacity" }
+ }
+ ]
+}
diff --git a/examples/bluetooth/chat/Search.qml b/examples/bluetooth/chat/Search.qml
new file mode 100644
index 00000000..f43ca622
--- /dev/null
+++ b/examples/bluetooth/chat/Search.qml
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the QtBluetooth module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+
+Rectangle {
+ property bool animationRunning: ranimation.running
+
+ function appendText(newText) {
+ searchText.text += newText
+ }
+
+ width: searchText.width + 40;
+ height: searchText.height + bluetoothImage.height + 40;
+ color: "white"
+ border.color: "black"
+ border.width: 1
+ radius: 5
+
+ Behavior on height {
+ NumberAnimation { duration: 300 }
+ }
+
+ Image {
+ id: bluetoothImage
+ source: "images/default.png"
+ anchors.top: parent.top
+ anchors.topMargin: 10
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ RotationAnimation on rotation{
+ id: ranimation
+ target: bluetoothImage
+ easing.type: Easing.InOutBack
+ property: "rotation"
+ from: 0
+ to: 360
+ duration: 2000
+ loops: Animation.Infinite
+ alwaysRunToEnd: true
+ }
+ }
+
+ Text {
+ id: searchText
+
+ anchors.top: bluetoothImage.bottom
+ //anchors.bottom: parent.bottom
+ anchors.topMargin: 10
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: qsTr("Searching for chat service...");
+ color: "black"
+
+ }
+}
+
diff --git a/examples/bluetooth/chat/chat.pro b/examples/bluetooth/chat/chat.pro
new file mode 100644
index 00000000..5cf6ab9f
--- /dev/null
+++ b/examples/bluetooth/chat/chat.pro
@@ -0,0 +1,16 @@
+QT = core bluetooth quick
+SOURCES += qmlchat.cpp
+
+TARGET = qml_chat
+TEMPLATE = app
+
+RESOURCES += \
+ chat.qrc
+
+OTHER_FILES += \
+ chat.qml \
+ InputBox.qml \
+ Search.qml \
+ Button.qml
+
+#DEFINES += QMLJSDEBUGGER
diff --git a/examples/bluetooth/chat/chat.qml b/examples/bluetooth/chat/chat.qml
new file mode 100644
index 00000000..e89c6b11
--- /dev/null
+++ b/examples/bluetooth/chat/chat.qml
@@ -0,0 +1,194 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the QtBluetooth module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtBluetooth 5.3
+
+Item {
+ id: top
+
+ Component.onCompleted: state = "begin"
+ property string remoteDeviceName: ""
+ property bool serviceFound: false
+
+ BluetoothDiscoveryModel {
+ id: btModel
+ running: true
+ discoveryMode: BluetoothDiscoveryModel.MinimalServiceDiscovery
+ onRunningChanged : {
+ if (!btModel.running && top.state == "begin" && !serviceFound) {
+ searchBox.appendText("\nNo service found. \n\nPlease start server\nand restart app.")
+ }
+ }
+
+ onServiceDiscovered: {
+ if (serviceFound)
+ return
+ serviceFound = true
+ console.log("Found new service " + service.deviceAddress + " " + service.deviceName + " " + service.serviceName);
+ searchBox.appendText("\nConnecting to server...")
+ remoteDeviceName = service.deviceName
+ socket.setService(service)
+ }
+ uuidFilter: "e8e10f95-1a70-4b27-9ccf-02010264e9c8"
+ }
+
+ BluetoothSocket {
+ id: socket
+ connected: true
+
+ onSocketStateChanged : {
+ console.log("Connected to server")
+ top.state = "chatActive"
+ }
+
+ onStringDataChanged : {
+ console.log("Received data: " )
+ var data = remoteDeviceName + ": " + socket.stringData;
+ data = data.substring(0, data.indexOf('\n'))
+ chatContent.append({content: data})
+ console.log(data);
+ }
+ }
+
+ ListModel {
+ id: chatContent
+ ListElement {
+ content: "Connected to chat server"
+ }
+ }
+
+
+ Image {
+ id: background
+ z: 0
+ anchors.fill: parent
+ source: "images/background.jpg"
+ fillMode: Image.PreserveAspectCrop
+ }
+
+ Search {
+ id: searchBox
+ anchors.centerIn: top
+ opacity: 1
+ }
+
+ Rectangle {
+ id: chatBox
+ opacity: 0
+
+ anchors.centerIn: top
+
+ width: top.width - 25
+ height: 300
+ color: "white"
+ border.color: "black"
+ border.width: 1
+ radius: 5
+
+ function sendMessage()
+ {
+ var data = input.text
+ input.clear()
+ chatContent.append({content: "Me: " + data})
+ socket.stringData = data
+ chatView.positionViewAtEnd()
+ }
+
+ Item {
+ anchors.fill: parent
+ anchors.margins: 10
+
+ InputBox {
+ id: input
+ Keys.onReturnPressed: chatBox.sendMessage()
+ height: sendButton.height
+ width: parent.width - sendButton.width - 15
+ anchors.left: parent.left
+ }
+
+ Button {
+ id: sendButton
+ anchors.right: parent.right
+ label: "Send"
+ onButtonClick: chatBox.sendMessage()
+ }
+
+
+ Rectangle {
+ height: parent.height - input.height - 15
+ width: parent.width;
+ color: "white"
+ anchors.bottom: parent.bottom
+ border.color: "black"
+ border.width: 1
+ radius: 5
+
+ ListView {
+ id: chatView
+ width: parent.width-5
+ height: parent.height-5
+ anchors.centerIn: parent
+ model: chatContent
+ clip: true
+ delegate: Component {
+ Text {
+ font.pixelSize: 18
+ text: modelData
+ }
+ }
+ }
+ }
+ }
+ }
+
+ states: [
+ State {
+ name: "begin"
+ PropertyChanges { target: searchBox; opacity: 1 }
+ PropertyChanges { target: chatBox; opacity: 0 }
+ },
+ State {
+ name: "chatActive"
+ PropertyChanges { target: searchBox; opacity: 0 }
+ PropertyChanges { target: chatBox; opacity: 1 }
+ }
+ ]
+}
diff --git a/examples/bluetooth/chat/chat.qrc b/examples/bluetooth/chat/chat.qrc
new file mode 100644
index 00000000..7e3e6c63
--- /dev/null
+++ b/examples/bluetooth/chat/chat.qrc
@@ -0,0 +1,13 @@
+<RCC>
+ <qresource prefix="/">
+ <file>chat.qml</file>
+ <file>images/background.jpg</file>
+ <file>images/clear.png</file>
+ <file>images/lineedit-bg-focus.png</file>
+ <file>images/lineedit-bg.png</file>
+ <file>InputBox.qml</file>
+ <file>images/default.png</file>
+ <file>Search.qml</file>
+ <file>Button.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/bluetooth/chat/images/background.jpg b/examples/bluetooth/chat/images/background.jpg
new file mode 100644
index 00000000..903d395c
--- /dev/null
+++ b/examples/bluetooth/chat/images/background.jpg
Binary files differ
diff --git a/examples/bluetooth/chat/images/clear.png b/examples/bluetooth/chat/images/clear.png
new file mode 100644
index 00000000..91eb2706
--- /dev/null
+++ b/examples/bluetooth/chat/images/clear.png
Binary files differ
diff --git a/examples/bluetooth/chat/images/default.png b/examples/bluetooth/chat/images/default.png
new file mode 100644
index 00000000..a1a74af5
--- /dev/null
+++ b/examples/bluetooth/chat/images/default.png
Binary files differ
diff --git a/examples/bluetooth/chat/images/lineedit-bg-focus.png b/examples/bluetooth/chat/images/lineedit-bg-focus.png
new file mode 100644
index 00000000..bbfac38d
--- /dev/null
+++ b/examples/bluetooth/chat/images/lineedit-bg-focus.png
Binary files differ
diff --git a/examples/bluetooth/chat/images/lineedit-bg.png b/examples/bluetooth/chat/images/lineedit-bg.png
new file mode 100644
index 00000000..9044226f
--- /dev/null
+++ b/examples/bluetooth/chat/images/lineedit-bg.png
Binary files differ
diff --git a/examples/bluetooth/chat/qmlchat.cpp b/examples/bluetooth/chat/qmlchat.cpp
new file mode 100644
index 00000000..3cd2424c
--- /dev/null
+++ b/examples/bluetooth/chat/qmlchat.cpp
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the QtBluetooth module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui/QGuiApplication>
+#include <QtQuick/QQuickView>
+#include <QtQml/QQmlEngine>
+#include <QtQml/QQmlContext>
+#include <QDebug>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication application(argc, argv);
+
+ const QString mainQmlApp = QLatin1String("qrc:/chat.qml");
+ QQuickView view;
+ view.setSource(QUrl(mainQmlApp));
+ view.setResizeMode(QQuickView::SizeRootObjectToView);
+ // Qt.quit() called in embedded .qml by default only emits
+ // quit() signal, so do this (optionally use Qt.exit()).
+ QObject::connect(view.engine(), SIGNAL(quit()), qApp, SLOT(quit()));
+ view.setGeometry(QRect(100, 100, 360, 640));
+ view.show();
+ return application.exec();
+}