You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
onPageDownloaded is a signal fn pageDownloaded(response: String)
onPageDownloaded: console.log("Page Downloaded "+ response); fails with an error ReferenceError: response is not defined, because attributes' names are not used on registration.
Remember, that in JS you can always check what are the arguments of the function (see this answer on SO)
2. Connect signal to function in qml like this
This is more verbose.
3. Provide an ability to register attribute name on registration.
Currently SignalDefinition consists of signal's name, number of attributes and their types. Is it possible to provide names of attributes as well?
The text was updated successfully, but these errors were encountered:
I would go with option 3.
Currently you can already obtain the signal argument from the qml slot.
If i'm not wrong inside a qml handler you can access the argument i-th argument with "arg0", "arg1" etc.
@filcuc ah, yes, so that's the fourth option to access attributes from qml handler.
Would be awesome to be able to register signals' attributes' names!
Obviously this is suboptimal given that we use "arg" as prefix instead of the name that the user wrote on its signal definition (however this solution simplify the development of the binding). Give me a couple of days for adding support in C++ (probably on a separate branch).
The original issue is White-Oak/qml-rust#8.
So the problem is :
onPageDownloaded
is a signalfn pageDownloaded(response: String)
onPageDownloaded: console.log("Page Downloaded "+ response);
fails with an errorReferenceError: response is not defined
, because attributes' names are not used on registration.I see three solutions to the original problem:
arguments
:Remember, that in JS you can always check what are the arguments of the function (see this answer on SO)
2. Connect signal to function in qml like this
This is more verbose.
3. Provide an ability to register attribute name on registration.
Currently
SignalDefinition
consists of signal's name, number of attributes and their types. Is it possible to provide names of attributes as well?The text was updated successfully, but these errors were encountered: