[Qbs] Fwd: Accessing overloaded properties

Иван Комиссаров abbapoh at gmail.com
Mon Jan 8 12:50:31 CET 2024


Fwd to the mail list

> 
> Hello!
> 
> We typically discourage usage of the id properties (the only use-case are Probes for the lack of other syntax) since Qbs is more «context» dependent and we provide some «magic» variables such as «product», «importingProduct» and so on.
> 
> You can use id prop if it works for you (but note that for e.g. Depends items id is not the id of the Depends item itself, but and alias for the imported module).
> 
> There are some other ways do do this. First, you can introduce an intermediate property to resolve the conflict:
> 
> MyProject {
>   installDir: "myfolder"
>   property string _temp: installDir
> 
>   MyProject {
>       installDir: _temp + "/mysubfolder"
>   }
> }
> 
> You can also try using «parent» variable but that’s not documented either and I’m not sure it’s OK to use it.
> 
> Ivan
> 
>> 8 янв. 2024 г., в 14:37, Jochen Becher via Qbs <qbs at qt-project.org> написал(а):
>> 
>> Happy New Year!
>> 
>> I havbe a question about qbs syntax. My qbs files look like this:
>> 
>> MyProject.qbs:
>> 
>> Project {
>> 	property string installDir: { throw "installDir must be set" }
>> }
>> 
>> AProject.qbs:
>> 
>> MyProject { 
>>   id: solution
>>   installDir: "myfolder"
>> 
>>   MyProject {
>>       installDir: solution.installDir + "/mysubfolder"
>>   }
>> }
>> 
>> My question is about"solution.installDir". Using "project.installDir"
>> doesn't work. "outer.installDir" or "base.installDir" is also not
>> allowed or not what I want.
>> 
>> But I am not sure if defining "id" and using it in a subitem like in
>> QML is really supported. It works and is sometimes but it is not
>> documented in the qbs manual.
>> 
>> Is using the id element correct? If not, what is the correct way to
>> accomplish this?
>> 
>> Regards, Jochen
>> 
>> _______________________________________________
>> Qbs mailing list
>> Qbs at qt-project.org
>> https://lists.qt-project.org/listinfo/qbs
> 



More information about the Qbs mailing list