[Qbs] Can't find variable when using custom property

Ola Røer Thorsen ola at silentwings.no
Mon Feb 5 14:43:57 CET 2018


I'm trying to do something like this:

import qbs
Rule {
    property var myProperty: "test"
    ...

    outputArtifacts: {
        console.warn(myProperty);
    }
}

qbs can't find "myProperty" in the line trying to print it, saying
ReferenceError: Can't find variable: myProperty

I've tried setting an id to the Rule item and using that, doesn't work. How
can I access properties like this from within the Rule item? This does not
seem to work well in general in qbs, except when defining a property in a
"Product" item.

My use-case here is that in another Product I plan to do this:
import "myrule.qbs" as MyRule
...
MyRule { myProperty: "1" }
MyRule { myProperty: "2" }
MyRule { myProperty: "3" }
MyRule { myProperty: "etc" }

Cheers,
Ola
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20180205/fe96b30a/attachment.html>


More information about the Qbs mailing list