Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Android QML canvas performance issue
Forum Updated to NodeBB v4.3 + New Features

Android QML canvas performance issue

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
4 Posts 2 Posters 1.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MartinD
    wrote on last edited by
    #1

    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?

    jsulmJ 1 Reply Last reply
    0
    • M MartinD

      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?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @MartinD said in Android QML canvas performance issue:

      canvas.requestPaint()

      why do you need to call it?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      M 1 Reply Last reply
      0
      • jsulmJ jsulm

        @MartinD said in Android QML canvas performance issue:

        canvas.requestPaint()

        why do you need to call it?

        M Offline
        M Offline
        MartinD
        wrote on last edited by
        #3

        @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.

        jsulmJ 1 Reply Last reply
        0
        • M MartinD

          @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.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @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?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved