FPS.qml 683 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import QtQuick 2.0
  2. // pretty much entirely stolen from:
  3. // https://github.com/capisce/motionblur/blob/master/main.qml
  4. // Required for effortless web serving!
  5. import ".."
  6. Widget {
  7. property real t
  8. property int frame: 0
  9. text: "FPS:" + fpsTimer.fps
  10. Timer {
  11. id: fpsTimer
  12. property real fps: 0
  13. repeat: true
  14. interval: 1000
  15. running: true
  16. onTriggered: {
  17. fps = frame
  18. frame = 0
  19. }
  20. }
  21. NumberAnimation on t {
  22. id: tAnim
  23. from: 0
  24. to: 100
  25. loops: Animation.Infinite
  26. }
  27. onTChanged: {
  28. update() // force continuous animation
  29. ++frame
  30. }
  31. }