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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Native Development

Reply
Developer
Jeff_Lu
Posts: 384
Registered: ‎08-12-2008
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 {
                        }
                    }

 

Please use plain text.
Contributor
jamespaulmuir
Posts: 30
Registered: ‎04-26-2010
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.

Please use plain text.
Developer
Jeff_Lu
Posts: 384
Registered: ‎08-12-2008

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

Thanks you, That help a lot.

 

Please use plain text.