Question

When using the Q_PROPERTY macro to define a property to Qt's property system, one of the available clauses is RESET. I know what the reset function is for, and how to create one, but I can't figure out when it would be triggered from QML. I notice that examples of reset function declarations I've looked at in the BlackBerry Cascades header files are not specified as Q_INVOKABLE, so you can't just call the function, but they are always defined as a slot. This makes me wonder if the property system has a hidden reset signal that is connected to the reset function slot when you use the RESET clause with Q_PROPERTY. This way it would get automatically triggered when some event happened from your QML. What this event might be is what I just can't figure out.

I've been through the Cascades and Qt documentation upside-down and sideways, and I can find lots of stuff about using the RESET clause and how the reset function must be declared, but nothing on what makes it trigger.

Does anyone have any insight on this?

Was it helpful?

Solution

Does anyone have any insight on this?

The RESET function set will be called for a property when a property is set to undefined. It is a javascript value, basically.

That being said, note that the RESET feature has some flaws, such as:

  • it will not work when undefined is a valid value.

  • it will not work when undefined is an invalid value.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top