Files
CuboBmsTool/qml/Screens/BmsServiceScreen.qml

75 lines
1.7 KiB
QML

import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import Controls 1.0 as Controls
import Cubo 1.0
ColumnLayout {
spacing: 20
Keys.onReturnPressed: sendButton.clicked()
Keys.onEnterPressed: sendButton.clicked()
Controls.Frame {
Flickable {
id: outputFlickable
clip: true
anchors.fill: parent
boundsBehavior: Flickable.StopAtBounds
TextArea.flickable: Controls.TextArea {
id: outputArea
}
ScrollBar.horizontal: Controls.ScrollBar {}
ScrollBar.vertical: Controls.ScrollBar {}
}
Layout.fillWidth: true
Layout.fillHeight: true
}
RowLayout {
spacing: 20
Controls.Button {
text: qsTr("Clear")
Layout.preferredWidth: 120
onClicked: outputArea.clear()
}
Controls.TextField {
id: commandField
implicitHeight: 52
Layout.fillWidth: true
}
Controls.Button {
id: sendButton
text: qsTr("Send")
Layout.preferredWidth: 120
onClicked: {
BmsInterface.commands().sendTerminalCmd(commandField.text)
commandField.clear()
}
}
Controls.Button {
text: qsTr("Help")
Layout.preferredWidth: 120
onClicked: BmsInterface.commands().sendTerminalCmd("help")
}
Layout.fillWidth: true
}
Connections {
target: BmsInterface.commands()
onPrintReceived: {
outputArea.append(str)
outputArea.cursorPosition = outputArea.length
}
}
}