Results 1 to 3 of 3

Thread: Qt Quick QML animation stressing CPU

  1. #1

    Default Qt Quick QML animation stressing CPU

    Hello,

    I'm planning to use QML to implement an appealing UI for a project. The UI will be displayed on a range of display sizes including very large monitors/TVs. I put together a QML example that's driven by the data that I will be displaying (data comes in once a second from a serial device). Following is the QML...

    Qt Code:
    1. import Qt 4.7
    2.  
    3. Rectangle {
    4. width: 640
    5. height: 480
    6. color: "white"
    7.  
    8. Rectangle {
    9. x: 0
    10. width: 100
    11. height: wattsCirc*(parent.height/wattScale)
    12. //height: watts/6
    13. radius: 15
    14. anchors.bottom: parent.bottom
    15. //anchors.horizontalCenter: parent.horizontalCenter
    16. smooth: true
    17. gradient: Gradient {
    18. GradientStop { position: 0.0; color: "lightsteelblue" }
    19. GradientStop { position: 1.0; color: "blue" }
    20. }
    21. Behavior on height { NumberAnimation { duration: 1000; easing.type: Easing.InOutBounce } }
    22. }
    23.  
    24. Rectangle {
    25. x: 100
    26. width: 100
    27. height: wattsCirc*(parent.height/wattScale)
    28. //height: watts/6
    29. radius: 15
    30. anchors.bottom: parent.bottom
    31. //anchors.horizontalCenter: parent.horizontalCenter
    32. smooth: true
    33. gradient: Gradient {
    34. GradientStop { position: 0.0; color: "lightsteelblue" }
    35. GradientStop { position: 1.0; color: "blue" }
    36. }
    37. Behavior on height { NumberAnimation { duration: 1000; easing.type: Easing.InOutBounce } }
    38. }
    39.  
    40.  
    41. // SAME RECTANGLE REPEATED ANOTHER FIVE TIMES
    42.  
    43. Text {
    44. text: "rawCurrent"
    45. y: 100
    46. x: 100
    47. }
    48.  
    49. Text {
    50. id: id_current
    51. text: rawCurrent
    52. y: 100
    53. x: 200
    54. }
    55.  
    56. // FOUR MORE TEXT ENTRIES LIKE THE ONE ABOVE, EACH DISPLAYING A DIFFERENT PROPERTY VALUE
    57. }
    To copy to clipboard, switch view to plain text mode 


    So there are six rectangles, all displaying the same information, all animated on height change (implementing bar charts). There are also five text items displaying values. The values that are bound to are exposed from C++ to the QML using setContextObject, and the class in question uses the Meta-Object System to expose the properties. All properties are changed once a second.

    When I run this example, I see that my CPU usage steadily climbs from something acceptable (~12%) to something that I think is too high (40-50%). Why would that be? It seems like a high load, considering that QML is targeted to mobile devices with much less processing power than my i5. Eliminating the QML UI and just running the underlying logic keeps CPU usage steady at 8%.

    Any help on this would be greatly appreciated,

    Peter

  2. #2

    Default Re: Qt Quick QML animation stressing CPU

    Proper threading of the underlying logic fixed this.

  3. #3
    Join Date
    Apr 2011
    Posts
    16
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt Quick QML animation stressing CPU

    hi,
    I wanted to know if you found a way to solve the problem of CPU consumption, because i have the same problem...
    tnx

Similar Threads

  1. 2 Quick Questions
    By bbad68 in forum Newbie
    Replies: 2
    Last Post: 10th February 2010, 18:26
  2. Re: Quick help on QProcess
    By ufo-vl in forum Newbie
    Replies: 8
    Last Post: 27th July 2007, 07:19
  3. Quick help on QProcess
    By devilj in forum Newbie
    Replies: 4
    Last Post: 17th July 2007, 22:16
  4. Quick Test Pro and Qt
    By tstankey in forum Newbie
    Replies: 1
    Last Post: 19th April 2007, 20:27
  5. Quick Help Needed with little App.
    By Sicko in forum Qt Programming
    Replies: 4
    Last Post: 19th December 2006, 10:17

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.