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