Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML Canvas - MouseArea Performance Issues
Forum Updated to NodeBB v4.3 + New Features

QML Canvas - MouseArea Performance Issues

Scheduled Pinned Locked Moved QML and Qt Quick
qml canvas mous
3 Posts 1 Posters 1.6k Views 1 Watching
  • 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
    MathArtist
    wrote on last edited by MathArtist
    #1

    **Hi Everybody! **

    I'm developing a very simple drawing tool for an application:
    My target platform is android
    The tool is quite simple
    A MouseArea over a Canvas.
    Every positionChange event on the MouseArea I add the new XY pair to an array.
    In a workerScript i make a subdivision of the trajectory to make the line smother.
    After that, in the onPaint of the canvas, I draw the latest additions to the trajectory.(Not The entire line, just last segment)
    The canvas "renderStrategy" is set to "Canvas.Threaded"

    So, I expected, the main UI thread to be free of the line smoother algorithm expensive calculations and the canvas drawing operations. BUT the MouseArea onPositionChanged is triggered much less often when the canvas is refresh.

    I make 2 tests. Shown in this image:

    Sample Image

    In both Figures:
    -The blue thin line with red dots is the debug input of the android device. (The nearest to real pen trajectory)
    -The black circles is where MouseArea onPositionChanged Triggered
    -The Green line is the smooth line result.

    In figure 1: The program is operating normally, drawing just the new segment as a new coordinate is input.

    In figure 2: The canvas is not updated until the entire line is complete.
    (Is not ultra perfect but acceptable the green line is under the thin Blue one near all time)

    So, I guess the MouseArea is refreshing less often because the CPU is busier, But moving the smooth algorithm to a workerScript and set the Canvas Render Strategy to Threaded didn't make any noticeable difference.

    Is necessary to setup something else to make it work? like including concurrence in the main cpp or in the pro file?
    As far as I can tell, real multi-thread performance is not noticeable following just the QML documentation.

    Am I doing something wrong? Is this a bug? Can it be done in other way?

    Thanks in advance!

    1 Reply Last reply
    0
    • M Offline
      M Offline
      MathArtist
      wrote on last edited by
      #2

      Still Loking for a solution!!!! Please some help will be well revived

      M 1 Reply Last reply
      0
      • M MathArtist

        Still Loking for a solution!!!! Please some help will be well revived

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

        Even in qt 5.5.1 the canvas performance is far far far far beyond from something remotely acceptable.

        Should I implement an equivalent solution with openGL and completely disregard the existence of the canvas element???

        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