[QBS] Use a Group declared in a template file

Kandeler Christian Christian.Kandeler at theqtcompany.com
Fri Sep 11 05:27:01 CEST 2015


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: qbs-bounces+christian.kandeler=theqtcompany.com at qt-project.org <qbs-bounces+christian.kandeler=theqtcompany.com at qt-project.org> on behalf of Axel A <e_ax13 at hotmail.fr>
Sent: Sunday, September 6, 2015 9:00 PM
To: qbs at qt-project.org
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20150911/68abb687/attachment.html>


More information about the Qbs mailing list