Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
gocolinn
Posts: 11
Registered: ‎01-15-2013
My Device: Playbook 32

QML list property

[ Edited ]

Hey.

 

I am new to QML.  I have some Tab's that I want to share action arrays to.  This is to decrease duplication. 

 

TabbedPane {
    id: myPane
    property list<ActionItem> actionListProperty: [
        ActionItem {
            title: "123"
        }
] Tab { Page { Container { actions : actionListProperty } } } }

 Is something like this possible?  I get an error in Momentics complaining about the < character in my list property, but I am following the directions given here : http://qt-project.org/doc/qt-4.7/qml-list.html

Contributor
gocolinn
Posts: 11
Registered: ‎01-15-2013
My Device: Playbook 32

Re: QML list property

[ Edited ]

Another failed attempt

 

Page {
    id: myPage
    property AbstractActionItem myList: [
        ActionItem {
            title: "123"
        }
        ]
    
    
    Tab {
        
            Page {
                    actions : myPage.myList
	                 
	             }
        }
}
    
    

 

 

 

Developer
lewellyn
Posts: 110
Registered: ‎10-22-2011
My Device: PlayBook, Bold 9650, Dev Alpha A

Re: QML list property

Would it work as attachedObjects?



Is there a helpful or useful post in this thread? Click the thumbs up on it so that other people can find it more easily!
Like this post too! :smileyvery-happy:
Developer
rcebryk
Posts: 84
Registered: ‎12-01-2012
My Device: 9790

Re: QML list property

I am sure it can be done in C++
You would just need to define the object name for TabbedPane
Lublin BlackBerry Developer Group


---
If I helped you please mark my response as solution or "Like" it.
Developer
bbdevguy
Posts: 107
Registered: ‎11-19-2008
My Device: Not Specified

Re: QML list property

I would also like to know the answer to this question. I am trying to maintain a basic list/array in QML that I can add items to depending on user interactions but everything I try, e.g. Javascript array does to work for me.

Developer
rcebryk
Posts: 84
Registered: ‎12-01-2012
My Device: 9790

Re: QML list property

With Javascript it can be done, but in qml it won't work. There is a bug in latest qt - you can create lists but you cannot change them. It is described somewhere in QT docs. That is probably why qml lists are not mentioned in cascades docs
Lublin BlackBerry Developer Group


---
If I helped you please mark my response as solution or "Like" it.
Developer
bbdevguy
Posts: 107
Registered: ‎11-19-2008
My Device: Not Specified

Re: QML list property


rcebryk wrote:
With Javascript it can be done, but in qml it won't work. There is a bug in latest qt - you can create lists but you cannot change them. It is described somewhere in QT docs. That is probably why qml lists are not mentioned in cascades docs

And how can a list/array be done using javascript alone without QML? I would like to have the equivalent of an array property that can be modified, with things added via push() etc. Sorry if this is an obvious question but I am relatively new to QML and Javascript.

Developer
rcebryk
Posts: 84
Registered: ‎12-01-2012
My Device: 9790

Re: QML list property

You must google, how to create lists and modify them in Javascriptem. I am afraid that you will be able to create lists of simple types likes int, float etc. In qml you can easily create a static list with any objects but you can not add/delete items.
Lublin BlackBerry Developer Group


---
If I helped you please mark my response as solution or "Like" it.
Contributor
gocolinn
Posts: 11
Registered: ‎01-15-2013
My Device: Playbook 32

Re: QML list property

I ended up giving up trying to figure it out and dropped the feature I wanted to add using lists (out of frustration).  I came to the (perhaps incorrect) conclusion that QML is only powerful enough for screen layouts.  Seems like a wasted oportunity and using QML actually took longer than C++ because all the time I saved on typing was spent trying to find work arounds for missing features.  I also found the inability to debug a problem for complex application development.