Canvas not repainting

I’ve created a hygrometer application using a circular gauge and used Canvas to decorate the dial. All is well until I minimise the app to cover and then go back to the page, then canvas is not painted.

I have spent hours trying with ‘canvas.requestPaint()’ and other methods but not one of them works.
Rotating the device is okay and swiping to the next attached page is okay, canvas stays painted.

I tried adding repaint() to the ‘onStatusChanged’ part of my page but no joy. I also put my canvases into seperate files and/or including them in the relevant page, but still I cannot get it/them to repaint after going to cover…sigh

Any canvas gurus here?, any ideas?

How can I get canvas to repaint after the app was minimised?

I don’t know if you are familiar with, it’s an interesting example of the use of canvas. However the repaint is done every second, because of the seconds update of the clock.

I have used the Canvas for my Hud app and I noticed that the dial disappears when the app was not active anymore. I solved it bij using a property: property bool appActive: and do onAppActiveChanged: canvas.requestPaint()

Thanks, I am familiar with neon clock and your app. Sadly, your Hud app does not run on either of my devices, nonetheless, I will take a look at both. The whole thing has given me a headache and quite honestly, it’s among a growing number of frustrations with SFOS, with little to no help from anybody, I sometimes wonder why I am wasting so much time on Sailfish, but then I’ve no desire to use iOS or Android.
Thanks again, if I have any joy, i’ll leave a comment! :slight_smile:

I cannot find anything related to Canvas in your Hud app, I downloaded the latest release from your openrepo and looked through it…where is Canvas in your app?

I was not satisfied with the result of the canvas so in the latest release I switched back to an image file for the dial line with a repeater. The previous release is available on openrepos.

1 Like

There is nothing Canvas related in the previous from latest version either.

Okay, I found it in 0.10-1

I found a workaround. it still uses Canvas, but only as an image. I took screenshots of just the canvas parts I wanted for decorating each dial, sent then to Photoshop and made .png copies, prety much what you said in your last comment about switching to an image file.

This is pleasing to the eye and yields a much better result than trying to use canvas normally.

Thanks for your input and ideas @rgrnetalk


I had the same problem in my pedometer, and solved it this way:

Canvas {
onVisibleChanged: requestPaint();

This also solved a problem with the canvas not being repainted after having been hidden by another page.

1 Like

Nice!, thanks for that. It does the job…that makes using Canvas all the more attractive, again :slight_smile: