[Qbs] How do I use Parameter property in a module itself?
Иван Комиссаров
abbapoh at gmail.com
Mon Jun 10 20:59:30 CEST 2019
However, this is an interesting question.
Is it true that all module properties should be allowed to be set per-file?
Product {
Depends { name: "mymodule"; }
mymodule.useFeature: true // enable some probes here, do heavy checks
Group { files: «file»; mymodule.useFeature: false; } // does nothing, all checks are already done
}
What worse, this won’t work at all:
Product {
Depends { name: "mymodule"; }
Group { files: «file»; mymodule.useFeature: true; } // ooops
}
> 10 июня 2019 г., в 20:45, Иван Комиссаров <abbapoh at gmail.com> написал(а):
>
> Yes, I’d like to have some syntax sugar here.
> But 2-liner is probably OK too.
>
>> 10 июня 2019 г., в 20:32, Richard Weickelt <richard at weickelt.de> написал(а):
>>
>> Ivan,
>>
>> Do you actually want to achieve this?
>>
>> Module {
>> property bool useFeature: false
>>
>> Probes.BinaryProbe {
>> condition: useFeature
>> }
>> }
>>
>> Product {
>> Depends { name: "mymodule"; }
>> mymodule.useFeature: true
>> }
>>
>> The Parameter item, as far as I understand it, makes only sense if you have
>> - 2 products A and B
>> - B depends on A and on mymodule
>> - in the context of B you want to control, how a module "mymodule"
>> handles A
>>
>> You wouldn't use it to just parameterize "mymodule", because that can be
>> achieved with plain properties.
>>
>> The probably best explanation so far of the Parameter item can be found in
>> the following blog post:
>> https://blog.qt.io/blog/2017/09/05/qbs-1-9-released/ I realize that the
>> reference documentation of the Parameter item is insufficient and the
>> example in the module documentation could be more sensible.
>>
>> Richard
>> _______________________________________________
>> Qbs mailing list
>> Qbs at qt-project.org
>> https://lists.qt-project.org/listinfo/qbs
>
More information about the Qbs
mailing list