Implemented a visualization screen for various board parameters

This commit is contained in:
Yury Shuvakin
2022-08-25 07:59:16 +03:00
parent 8abae06275
commit d1ba61acd8
19 changed files with 675 additions and 15 deletions

View File

@@ -9,7 +9,7 @@ Button {
contentItem: Text {
text: control.text
font.pixelSize: 16
font.weight: Font.ExtraBold
font.weight: Font.Bold
opacity: enabled ? 1.0 : 0.3
color: Palette.alternativeTextColor
horizontalAlignment: Text.AlignHCenter

100
qml/Controls/ChartView.qml Normal file
View File

@@ -0,0 +1,100 @@
import QtQuick 2.12
import QtCharts 2.3
import Utils 1.0
ChartView {
id: chart
antialiasing: true
backgroundColor: Palette.backgroundColor
margins.left: 20
legend.visible: false
legend.alignment: Qt.AlignRight
legend.markerShape: Legend.MarkerShapeCircle
property AbstractAxis xAxis: valueAxisX
property AbstractAxis yAxis: valueAxisY
property int defaultXMax: 10
property int defaultYMax: 1
property bool autoScaling: true
ValueAxis {
id: valueAxisX
min: 0
max: chart.defaultXMax
tickCount: 8
gridVisible: false
gridLineColor: Palette.borderColor
labelsColor: Palette.contentTextColor
labelsFont.pixelSize: 18
color: Palette.borderColor
titleVisible: false
}
ValueAxis {
id: valueAxisY
min: 0
max: chart.defaultYMax
tickCount: 6
labelsColor: Palette.contentTextColor
labelsFont.pixelSize: 18
color: Palette.borderColor
titleVisible: false
}
MouseArea {
id: chartMouseAreaA
anchors.fill: parent
acceptedButtons: Qt.LeftButton
property real lastMouseX: 0
property real lastMouseY: 0
property real scrollThreshold: 0
onMouseXChanged: {
if ((mouse.buttons & Qt.LeftButton) == Qt.LeftButton) {
if (mouseX - lastMouseX > scrollThreshold) {
chart.scrollLeft(mouseX - lastMouseX)
lastMouseX = mouseX
chart.autoScaling = false
} else if (mouseX - lastMouseX < scrollThreshold) {
chart.scrollRight(lastMouseX - mouseX)
lastMouseX = mouseX
chart.autoScaling = false
}
}
}
onMouseYChanged: {
if ((mouse.buttons & Qt.LeftButton) == Qt.LeftButton) {
if (mouseY - lastMouseY > scrollThreshold) {
chart.scrollUp(mouseY - lastMouseY)
lastMouseY = mouseY
chart.autoScaling = false
} else if (mouseY - lastMouseY < scrollThreshold) {
chart.scrollDown(lastMouseY - mouseY)
lastMouseY = mouseY
chart.autoScaling = false
}
}
}
onPressed: {
if (mouse.button === Qt.LeftButton) {
lastMouseX = mouseX
lastMouseY = mouseY
}
}
onWheel: {
if (wheel.angleDelta.y > 0) {
chart.zoomIn()
chart.autoScaling = false
} else {
chart.zoomOut()
chart.autoScaling = false
}
}
}
}

View File

@@ -28,7 +28,7 @@ CheckBox {
contentItem: Text {
text: control.text
font.pixelSize: 18
font.weight: Font.ExtraBold
font.weight: Font.Bold
color: Palette.textColor
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter

View File

@@ -6,6 +6,6 @@ import Utils 1.0
Label {
color: Palette.contentTextColor
font.pixelSize: 18
font.weight: Font.Medium
font.weight: Font.Normal
elide: Text.ElideRight
}

View File

@@ -6,7 +6,7 @@ import Utils 1.0
Label {
color: Palette.textColor
font.pixelSize: 18
font.weight: Font.ExtraBold
font.weight: Font.Bold
elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter

View File

@@ -7,7 +7,7 @@ Label {
id: control
color: Palette.selectedTextColor
font.pixelSize: 18
font.weight: Font.Medium
font.weight: Font.Normal
font.underline : true
elide: Text.ElideRight

View File

@@ -9,7 +9,7 @@ Button {
contentItem: Text {
text: control.text
font.pixelSize: 16
font.weight: Font.ExtraBold
font.weight: Font.Bold
opacity: enabled ? 1.0 : 0.3
color: control.hovered ? Palette.alternativeTextColor : Palette.textColor
horizontalAlignment: Text.AlignHCenter

View File

@@ -6,6 +6,6 @@ import Utils 1.0
Label {
color: Palette.textColor
font.pixelSize: 18
font.weight: Font.ExtraBold
font.weight: Font.Bold
elide: Text.ElideRight
}

20
qml/Controls/TabBar.qml Normal file
View File

@@ -0,0 +1,20 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import Utils 1.0
TabBar {
id: control
background: Rectangle {
color: Palette.backgroundColor
Rectangle {
height: 1
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
color: Palette.borderColor
}
}
}

View File

@@ -0,0 +1,44 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import Utils 1.0
TabButton {
id: control
contentItem: Text {
text: control.text
font.pixelSize: 18
font.weight: Font.Bold
opacity: enabled ? 1.0 : 0.3
color: control.checked ? Palette.selectedTextColor : Palette.textColor
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
background: Item {
implicitWidth: 150
implicitHeight: 58
Rectangle {
property bool selected: control.checked
height: 2
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
color: Palette.alternativeBackgroundColor
visible: selected
// Behavior on selected {
// PropertyAnimation {
// properties: "selected";
// easing.type: Easing.OutElastic;
// easing.amplitude: 0.2;
// easing.period: 0.2
// }
// }
}
}
}

View File

@@ -6,6 +6,6 @@ import Utils 1.0
Label {
color: Palette.selectedTextColor
font.pixelSize: 28
font.weight: Font.ExtraBold
font.weight: Font.Bold
elide: Text.ElideRight
}

View File

@@ -16,3 +16,6 @@ LabelWithBackground 1.0 LabelWithBackground.qml
CheckBox 1.0 CheckBox.qml
LineSeparator 1.0 LineSeparator.qml
LinkLabel 1.0 LinkLabel.qml
TabButton 1.0 TabButton.qml
TabBar 1.0 TabBar.qml
ChartView 1.0 ChartView.qml