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
Developer
Posts: 384
Registered: ‎08-12-2008
My Device: 8700
Accepted Solution

Is it possible to include a qml file within another file?

Hi There,

 

I am trying to create a ListView like stamp sample,

However, all those QML files are within one folders

what I am trying to do is to create some various QML files, and some of these files are shared within other files.

 

for example: I snap the code from stampcollectorapp qml,

 

                    // Second level item see the component in StampItem.qml. 
                    ListItemComponent {
                        type: "item"
                        StampItem {
                        }
                    }

 The line at [StampItem] is looking another QML file,

 

If I define StampItem within other asset folder, How to write it, and thanks?

                    // Second level item see the component in StampItem.qml. 
                    ListItemComponent {
                        type: "item"
                        myqmlpath???/StampItem {
                        }
                    }

 

Contributor
Posts: 33
Registered: ‎04-26-2010
My Device: Z10 / PlayBook 16GB
My Carrier: Verizon

Re: Is it possible to include a qml file within another file?

I think you have to import them at the top of your qml, the sample quotes app has qml files in subfolders

 

see here:

https://github.com/blackberry/Cascades-Samples/blob/master/quotes/assets/main.qml

 

EditScreen is imported into main.qml, and EditScreen is in assets/EditScreen/EditScreen.qml

 

I'm not sure if the folder name being the same as the qml file name is a convention, so I would try to mess around and see what works.

Developer
Posts: 384
Registered: ‎08-12-2008
My Device: 8700

Re: Is it possible to include a qml file within another file?

Thanks you, That help a lot.