I'm not entirely sure what the problem is here (in particular: what kind of 
behavior you expect). If you really want to add a file to the "QML" group, then 
that happens in the context of the parent item, because that's where the group 
is defined. If you do not want to add a file to that group, but to the 
"qmlFiles" list in the inheriting product, then you need to do that manually 
(i.e. via the text editor), as Qt Creator has no way of knowing that that 
property influences the list of source files.

Christian

________________________________
From: [email protected] 
<[email protected]> on behalf of 
Axel A <[email protected]>
Sent: Sunday, September 6, 2015 9:00 PM
To: [email protected]
Subject: [QBS] Use a Group declared in a template file

Hi,

I currently work on a qbs template to create QML extension plugins.

I created a 'qmlFiles' list property and a Group Item, so the user just need to 
inherit from my template qbs file and set the property :

// QmlPlugin.qbs
[...]
Group {
        name: "QML"
        files: qmlFiles
        fileTags: "qml"
        qbs.install: true
        qbs.installDir: CustomFuncs.uriToPath(uri)
}

But it seems I misunderstood something. Let's inherit from QmlPlugin.qbs :

// MyPlugin.qbs
QmlPlugin {
        // set the qmlFiles property
}

In QtCreator, the Projects tree is like :
MyPlugin
-- QML // <-- The magic Group
---- QmlPlugin.qbs:XX // <-- /!\ problem
---- SomeFile.qml
---- AnotherFile.qml

As you see here, the referenced qbs file is the template. So, when I use the 
Projects tree's context menu to add QML files, the default path is the path 
where QmlPlugin.qbs is located (and not MyPlugin.qbs). It decreases the user 
experience a little bit.

Note that I set the qbsSearchPath in my project qbs file to allow Qbs to find 
QmlPlugin.qbs.

Am I using Qbs properly ? Is there a way to create reusable Qbs components like 
this ?

Thank you very much,

Axel A
_______________________________________________
QBS mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/qbs

Reply via email to