LedDisplay/OmobiDisplayApp/main.qml

54 lines
1.2 KiB
QML

import QtQuick 2.12
import QtQuick.Controls 2.0
import QtQuick.Window 2.12
import de.itsblue.omobidisplayapp 1.0
import de.itsblue.bluetoothleuart 1.0
ApplicationWindow {
width: 640
height: 480
visible: true
title: qsTr("Hello World")
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"])
}
}
}
}
}