[QBS] Get property from parent project

olivier musse olivier.musse at sfr.fr
Thu May 22 16:19:32 CEST 2014


Hi Christian,

Property inheritance is really nice and simple. Thanks for this 
important information.
  I have succeed to verify it, but then have another question : How can 
I detect in the sub project if the property is already set at an higher 
level project.
Project
{
     property string myprop:"val1"
Project{
         myprop: {here set to "val2" if not already existing}
     }
}

About the prefix usage, I think this is not a bug in qbs. In fact, i'm 
working with qbs plugin in qcreator and have noticed that often, 
modifications in qbs files are not taken into account.  I need to close 
qcreator, delete the build dir and .qbs.user file and reopen my project 
for my modif to be taken into account.
The bug was a false alarm due to this qbs plugin bug.

Many thanks for you precious help.

Regards

> On 05/22/2014 01:26 PM, olivier musse wrote:
>> I have a project with subproject and so on.
>> When in a product or a subproject, how to access parent project
>> properties. Sometimes it seems to be "project.MyProperty", sometimes
>> "MyProperty"
>> Is there any documentation to clarify this point?
> Simple: Project properties are inherited by sub-projects. If you use the
> property outside of a Project item, you need to access it via the magic
> "project" property.
>
>> As an example
>>
>> Project {
>>        property string myprop1 : "val1"
>>
>>        product{
>>            property string myproductprop
>>            Depends{name:project.myprop1}     //in this case seems the
>> project prefix is needed
> Yes, because you are not directly in a Project item.
>
>>            myproductprop:myprop1 //in this case with project prefix it
>> does not work and seems to works without it
> No, I don't think so. If you are sure about it, please file a bug report
> and attach the complete project.
>
>
> Christian
> _______________________________________________
> QBS mailing list
> QBS at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qbs
>



More information about the Qbs mailing list