Implemented QML skeleton for the application
This commit is contained in:
49
qml/Screens/ConnectionScreen.qml
Normal file
49
qml/Screens/ConnectionScreen.qml
Normal file
@@ -0,0 +1,49 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Dialogs 1.2
|
||||
import QtQuick.Layouts 1.12
|
||||
|
||||
import Controls 1.0 as Controls
|
||||
import Cubo 1.0
|
||||
import Utils 1.0
|
||||
|
||||
Dialog {
|
||||
id: root
|
||||
title: qsTr("Connection Screen")
|
||||
width: 300
|
||||
height: 300
|
||||
standardButtons: Dialog.NoButton
|
||||
|
||||
contentItem: Rectangle {
|
||||
color: Palette.screenBackgroundColor
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 45
|
||||
|
||||
Label {
|
||||
text: qsTr("Select serial port")
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
|
||||
}
|
||||
|
||||
Controls.ComboBox {
|
||||
id: serialBox
|
||||
model: BmsInterface.serialPortNames()
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
}
|
||||
|
||||
Controls.AlternativeButton {
|
||||
text: qsTr("Connect")
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
|
||||
onClicked: {
|
||||
var currentPort = BmsInterface.serialPortNames()[serialBox.currentIndex]
|
||||
if (BmsInterface.connectSerial(currentPort))
|
||||
root.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user