PDA

View Full Version : using component's id in another QML



amitpatel22
11th August 2011, 06:01
Hi..

Is it possible to use id of one component in QML file to another QML file?
if it is,then what is the way to use it?
please explain me with example.
its urgent.

Waiting for quick reply..

Thanks..

coredump
11th August 2011, 06:53
two use cases:

1. use outer items' id in inner item ...... yes
1. use inner items' id in outer item ...... no

for example:
A.qml
======
import "."
Item {
id:outer
B { id: inner } //B.qml
Component.onCompleted: {
//console.log(inner.invisibleId.x); //error
//console.log(inner.b.x); //error
}
}

B.qml
=====
Item {
id:b
Item { id: invisibleId}
Component.onCompleted: {
console.log(outer.x); //sucess: access outer item's id
}
}

slimittn
22nd May 2013, 17:01
Hi,

is there a simple way to access inner items' id in outer item ?