Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#114: update battery component #119

Merged
merged 1 commit into from
Oct 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 32 additions & 10 deletions NERODesign/content/Battery.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,51 @@ Item {
Rectangle {
id: topOutlet
x: parent.width / 2 - parent.width / 4
width: parent.width / 2
width: parent.width / 4.5
height: parent.height
color: "white"
radius: 30
color: battery.value > 70 ? "#55FF00" : battery.value > 40 ? "orange" : "red"
anchors.centerIn: parent
}

Rectangle {
id: mainContainer
width: parent.width
y: 48
width: parent.width / 2.15
height: parent.height - parent.height / 10
color: "white"
radius: 30
color: battery.value > 70 ? "#55FF00" : battery.value > 40 ? "orange" : "red"
anchors.bottom: parent.bottom
anchors.bottomMargin: 0
anchors.horizontalCenterOffset: 0
anchors.horizontalCenter: parent.horizontalCenter

Rectangle {
id: fillContainer
width: parent.width - (battery.horizontalFillMargin * 2)
height: (parent.height - (battery.verticalFillMargin * 2))
* (battery.value / battery.maxValue)
color: battery.value > 70 ? "#55FF00" : battery.value > 40 ? "orange" : "red"
id: emptyContainer
y: 123
width: parent.width - (battery.horizontalFillMargin * 1.5)
height: (parent.height - (battery.verticalFillMargin * 3))
radius: 30
color: "black"
anchors.bottom: parent.bottom
anchors.bottomMargin: 36
anchors.horizontalCenterOffset: 0
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottomMargin: battery.verticalFillMargin

Rectangle {
id: fillContainer
y: 136
width: parent.width
height: (parent.height * (battery.value / battery.maxValue))
gradient: Gradient {
GradientStop { position: 0.0; color: battery.value > 70 ? "#55FF00" : battery.value > 40 ? "orange" : "red" }
GradientStop { position: 1.0; color: "black" }
}
anchors.bottom: parent.bottom
anchors.bottomMargin: 0
anchors.horizontalCenterOffset: 0
anchors.horizontalCenter: parent.horizontalCenter
}
}
}
}
Loading