Android QML canvas performance issue



  • I use Qt 5.7.1 on Android.

    My app contains some QML animations. They run smoothly until I use QML canvas in my app:

        Canvas {
            id: canvas
            onPaint: {
                var ctx = getContext("2d");
                ctx.reset();
            }
        }
    
        Timer {
                interval: 100; running: true; repeat: true
                onTriggered: canvas.requestPaint();
            }
    

    The canvas paint method does nothing, only resets context.

    This code causes my app not to run smoothly. Is there a bug in QML canvas or is there something bad in my code?


  • Moderators

    @MartinD said in Android QML canvas performance issue:

    canvas.requestPaint()

    why do you need to call it?



  • @jsulm There is additional code in my app - I need to redraw canvas when some property changes. But that's important. I don't think requesting canvas to paint and resetting it should block GUI thread.


  • Moderators

    @MartinD said in Android QML canvas performance issue:

    I need to redraw canvas when some property changes

    Why don't you redraw when those properties change instead of doing it via timer?


Log in to reply