[Interest] Dynamically generating a states and transitions array in javascript?

Mark markg85 at gmail.com
Wed Nov 28 04:16:49 CET 2012


Op 26 nov. 2012 22:11 schreef "Mark" <markg85 at gmail.com> het volgende:
>
> Hi,
>
> I have a states array in QML that looks like this:
>     states: [
>         State {
>             name: "icon"
>             PropertyChanges { target: viewContainer; source:
> "views/IconView.qml" }
>         },
>         State {
>             name: "list"
>             PropertyChanges { target: viewContainer; source:
"views/LView.qml" }
>         },
>         State {
>             name: "tree"
>             PropertyChanges { target: viewContainer; source:
> "views/TreeView.qml" }
>         }
>     ]
>
> That works just fine, but i want to do it more dynamically. I want to
> read the contents of the folder "views" and add a state entry for each
> item that i fine. Reading the folder and getting the filename isn't an
> issue, but i'm kinda puzzled how to build up a states array in
> javascript.
>
> This is an pseudo code example:
> buildstates.js
>
> var stateArray = ... construct the states based on based on the
> content of a folder ...
>
> main.qml
> import "buildstates.js" as BuildStates
>
> Item{
>     width: 800
>     height: 600
>     states: BuildStates.stateArray
> }
>
> I want to do the same for transitions.
> But how do i do the JavaScript part? Or is there another way to build
> up a dynamic states/transitions array? Or is there a C++ way for this?
>
> Cheers,
> Mark

Anyone..?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20121128/6138af0f/attachment.html>


More information about the Interest mailing list