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. How to implement "property value write interceptors"?
Forum Updated to NodeBB v4.3 + New Features

How to implement "property value write interceptors"?

Scheduled Pinned Locked Moved QML and Qt Quick
6 Posts 2 Posters 2.0k 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.
  • F Offline
    F Offline
    Frime
    wrote on last edited by
    #1

    Hi Community!

    I would like to implement a custom property animation like the QML "Behavior" object. (Behavior on <property> {Animation{}} ).. The goal is to implement a PropertyAnimation with customizable frame rate to increase performance. Therefore i need a mechanism as described in the QtDocumentation: "http://qt-project.org/doc/qt-5/qtqml-cppintegration-definetypes.html#property-modifier-types":http://qt-project.org/doc/qt-5/qtqml-cppintegration-definetypes.html#property-modifier-types

    But it is nowhere explained how to implement that. I need a way to receive and intercept a modified Property in my C++ implementation subclassed from QQmlPropertyValueSource.

    So, can anybody provide a small example / guideline about this issue?

    Thank you very much in advance!
    Frime

    1 Reply Last reply
    0
    • GianlucaG Offline
      GianlucaG Offline
      Gianluca
      wrote on last edited by
      #2

      I've never do that ... but from the documentation seems not possibile:
      [quote]Clients can register their own property value source types, but currently not property value write interceptors.[/quote]

      1 Reply Last reply
      0
      • F Offline
        F Offline
        Frime
        wrote on last edited by
        #3

        Hi!

        Thanks for your answer..But I think it should be possible, because "Behavior" object does the job..

        If it's really not possible: Are there any other proposals how to reduce the frame rate of animations?

        Thanks again,
        Frime

        1 Reply Last reply
        0
        • GianlucaG Offline
          GianlucaG Offline
          Gianluca
          wrote on last edited by
          #4

          "Behavior" is something built-in into Qt. What I guessed from documentation is that it's not possible to extend from a user. So, it's something not pluggable.

          However, changing topic on frame rate ... what do you exactly mean about 'frame rate of animations' ?
          Because, from what I know there is no such concept into the Animation framework. An animation is based on a timeline. It does something in a certain amount of time. So, it's does not depend on the frame rate on which the application runs.
          So, if the animation dictates that a property has to pass from 1.0 to 2.0 into 5 seconds, this happens either the app runs at 25 frame per seconds either the app runs at 50 frame per seconds.

          So, it's not clear to me what you want to achieve.

          1 Reply Last reply
          0
          • F Offline
            F Offline
            Frime
            wrote on last edited by
            #5

            Hi Gianluca,

            thanks for reply! I develop a QML app running on a low-performance embedded system. Some of my custom controls (kind of speedometers) are using Property Animations. I already reimplemented the animated part directly in QMLSzenegraph (instead of QmlCanvas, like before) with much success.
            ( ~80% CPU load with QML Canvas and ~40% with QML Szenegraph). But without any animations, my App runs at 7% CPU!

            The default frame rate of QML animations is roundabout 62 FPS. This frame rate is much higher than needed for my purposes.. So why don't decrease it to save performance for backend activities? Its simply not necessary to waste CPU performance for animations, which are not needed in that quality.. 30 FPS are absolutely sufficient. And I assume that the CPU Load scales linear to the frame rate.. That's all (;

            1 Reply Last reply
            0
            • GianlucaG Offline
              GianlucaG Offline
              Gianluca
              wrote on last edited by
              #6

              Hummm.. from what I know the update of Animations are synced with the refresh of the screen.
              And I don't know if there is a way to tell to Qt QML application to change it's refresh interval.
              I think that you can solve your problem if you can slow down the global refresh of the QML app. (but I don't know if Qt has an api for that).

              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