LedDisplay/OmobiDisplayApp/main.qml

55 lines
1.2 KiB
QML
Raw Normal View History

2020-10-08 20:06:57 +02:00
import QtQuick 2.12
import QtQuick.Controls 2.0
import QtQuick.Window 2.12
2020-10-09 00:03:50 +02:00
import de.itsblue.omobidisplayapp 1.0
import de.itsblue.bluetoothleuart 1.0
2020-10-08 20:06:57 +02:00
ApplicationWindow {
width: 640
height: 480
visible: true
title: qsTr("Hello World")
2020-10-09 00:03:50 +02:00
Page {
id: app
anchors.fill: parent
OmobiDisplayBackend {
id: backend
}
Button {
id: connectButton
text: "Scan for devices"
visible: backend.bleController.state === QBluetoothLeUART.Idle
onClicked: {
backend.bleController.startScanningForDevices()
}
}
ListView {
id: list
anchors.top: connectButton.bottom
anchors.margins: 10
height: parent.height
model: backend.bleController.avaliableDevices.length
delegate: Button {
property var thisDevice: backend.bleController.avaliableDevices[index]
text: thisDevice["name"]
onClicked: {
backend.bleController.connectToDevice(thisDevice["id"])
}
}
}
}
2020-10-08 20:06:57 +02:00
}