[QBS] [Qt-qml] Is there a QML "+=" concept?

Joerg Bornemann joerg.bornemann at nokia.com
Mon Apr 30 09:44:46 CEST 2012


On 30/04/2012 02:56, ext Charley Bay wrote:

> An example use would be the QML-description for the QBS build
> definition. I find the "describe-lists-of-files" quite awkward (e.g.,
> "a-little-off"). We *must* be able to declare *partial-sets* of things,
> with the understanding that those sets will be *grown/adjusted* later.
> It seems so fundamental to me, and I see "go-to-Javascript" as the
> "goto-last-resort" only when you have no other choice.

In qbs there's also no special += operator or magic append_foo 
properties. There's just a special value to

You can define the initial set of files like this

---myapp.qbp---
Application {
     files: ["file1.cpp", "file2.cpp"]
}
---------------

When using QML-inheritance you can do enhance the file list like this:

---MyApp.qbs---
Application {
     // all of my apps have the same about dialog
     files: [
         "aboutdlg.h",
         "aboutdlg.cpp",
         "aboutdlg.ui"
     ]
}
---myconcreteapp.qbp---
Application {
     // this would overwrite the files property
     //files: ["file1.cpp", "file2.cpp"]

     // append our new list of files to the files value in MyApp
     files: base.concat(["file1.cpp", "file2.cpp"])
}
---------------

The special 'base' value contains the value of the files property in the 
MyApp item.

Different file sets can be defined by using Group items.
These sets are joined together. The same as above can be achieved with a 
Group like this:

---myconcreteapp.qbp---
Application {
     Group {
         files: ["file1.cpp", "file2.cpp"]
     }
}
---------------


BR,

Jörg



More information about the Qbs mailing list