Qt World Summit: Register Today!

Dynamic Q_PROPERTY Read / Write function ?

  • Hi!

    I have created some dynamic properties in my C++ class.
    Is it possible to read the value of such a dynamic property from qml?
    In qml I get noticed if the dynamic properties change, because of the onPropertyChanged signal.
    But I want to read the value of a dynamic property once when the qml componentd was created (Component.onCompleted).
    Has anyone an idea how I can do this?

    Kind regards,

  • Pretty sure that will show you what you need.

    You can also jump straight into code and start tinkering - it's an example application. Just go to the Qt Creator welcome screen, examples and search "Writing QML Extensions with C++"

  • @6thC: Thanks for the hint.

    I solved my problem by calling a C++ function which was made available by Q_INVOKABLE. In this function I am fetching and returning the requested data to the qml.

Log in to reply