[Qbs] Property accessibility from Probe in 1.11

Christian Kandeler christian.kandeler at qt.io
Wed Feb 7 17:59:14 CET 2018


On Wed, 7 Feb 2018 16:58:16 +0100
<resurrection at centrum.cz> wrote:

> Project {
>     property var someProperty: "Hello" //explicit property
>  
>     Probe {
>         id: scanner
>         configure: {
>             console.info(someProperty)
>             console.info(sourceDirectory)
>         }
>     }
> }
>  
> Now this used to work. But now it does not in 1.11 with Qbs complaining about both properties being unknown. And since there is no "project" property in Probe one has to do:
>  
> Project {
>     property var someProperty: "Hello" //explicit property
>  
>     Probe {
>         id: scanner
>         property var parent: project
>         configure:  {
>             console.info(parent.someProperty)
>             console.info(parent.sourceDirectory)
>         }
>     }
> }
>  
> Was this change intentional?

Yes. By having to explicitly provide all input properties, you are forced declare an interface for your Probe, so that it is immediately obvious both to you and to qbs which properties are relevant (and thus need to be considered when figuring out whether the Probe has to be re-run).
Note that you have tricked the system by providing an item rather than a property. This defeats the purpose, and we don't guarantee that it will keep working. 


Christian



More information about the Qbs mailing list