-
Notifications
You must be signed in to change notification settings - Fork 11
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
Improve rendering of BarGauge #1051
Conversation
4db3b39
to
5ab2832
Compare
components/BarGauge.qml
Outdated
? orientation === Qt.Vertical | ||
? height - (height * _value) // slide in from bottom to top | ||
: -width + (width * _value) // slide in from left to right | ||
: 0 | ||
|
||
on_NextPosChanged: { | ||
on_NextPosChanged: if (visible) _updateGauge() | ||
onVisibleChanged: if (visible) _updateGauge() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice and simple. 👌 😊
I am still seeing some funky stuff. Boat/Motorhome demo 1: Quantity label showing 68%, gauge 0%: Boat/Motorhome demo 2: Quantity label showing 67%, Gauge showing first ~75% in expanded mode, than after collapsing ~55%: |
Thanks, will investigate those ones |
Setting |
- Always calculate the _nextPos on _value change, regardless of item visibility - Only animate to _nextPos if the previous animation has completed, to avoid "over animating" - Enable a layer for the source item - Specify explicit z ordering for each element Fixes #1003
Nope, still broken. |
5ab2832
to
7a5536d
Compare
Updated with a new clipping bar gauge. It only works for the Tank gauges, and not for other cases (e.g. overview page etc) because it requires a fully opaque "surface colour" to be specified which allows us to draw the rounded edge properly. Needs more testing, as reproducing this issue can be a bit hit and miss, but I think it's ready for review. |
7a5536d
to
63ba767
Compare
Great catch! 💪 There has also been discussion about gauges moving out of sync with the value labels in Bea's side panel gauge PRs. At the time Bea tried to investigate the issue, but had no luck. I thought the sync issue was related to labels showing watts and gauges being based on currents, but maybe we are talking about the same issue here? For one I vaguely remember only seeing the sync issues on GX devices. |
Could maybe refactor so BarGauge and ClippingBarGauge share the same base component, now this duplicates fair share of code? This fixes tanks, but potentially other gauges are also affected. Ideally there was one fix that helps all the cases. Should we file a bug to Qt about broken MultiEffect? If MultiEffect is culprit could try doing masks with just ShaderEffect to see if helps. Used to be simple in Qt 5:
Didn't have Qt 6 version lying around, so still need to apply small syntax changes Qt 6 brought and move the shader to a (ugh) separate qsb file. |
I created my own OpacityMaskEffect: But it doesn't fix the issue - it just doesn't render, sometimes. I suspect the problem is the old Mali400 drivers, it has a few issues. Note that the issue you noted above: "gauges moving out of sync with the value labels" is likely the "double animation" issue which I've already fixed. The MultiEffect / OpacityMaskEffect issue I'm seeing is that the bar doesn't get rendered at all (well, the foreground part of the bar) in some cases. I will create a base type which encapsulates all of the logic and properties. |
The opacity mask shader effect sometimes didn't render properly on device. This commit adds a new clip-based tank gauge instead.
63ba767
to
9d395ab
Compare
Done. FYI the PR to convert over to fully opaque colours was #689 but it's quite old and I'm certain it will need to be updated now, if we want to go that way. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, didn't see any issues with the tanks anymore.
But it doesn't fix the issue - it just doesn't render, sometimes. I suspect the problem is the old Mali400 drivers, it has a few issues.
Thanks for testing. 🙏
"gauges moving out of sync with the value labels" is likely the "double animation" issue which I've already fixed
Cool! There is still some other issue lurking somewhere as still seeing gauge updating differently to value on GX device:
https://github.com/victronenergy/gui-v2/assets/2203667/989aeb5b-b9fc-4b59-bcef-54fe0dfb2df5
Doesn't reproduce with the mock backend, where gauge and quantity label always update in sync.
I will create a base type which encapsulates all of the logic and properties.
Looks good. 👍
Could add comment somewhere why we need to BarGauge implementations.
Hmm, interesting that the load graph matches the bar gauge, but the label is completely different to both of them... I will take another look tomorrow. |
FYI Customer "pwfarnell" reported with the latest 0.3.0 release: "Just checked with ~16. On the Cerbo the bars on the level display are working OK ... On VRM the bars are still missing or wrong at times." I guess we should ask him to retest after we get these improved merged. |
I took a look into the side panel thing, and the reason is that the label shows the current, whereas the bar (and graph) shows the ratio. e.g.
So they can "get out of sync" if the maxCurrent suddenly changes (due dynamic ranging? not sure). |
Everyone happy for me to merge this one as-is? |
Yes that's right, the max current could change due to dynamic ranging or if the AC input gauge changes between import-only and import-export. |
Fixes #1003