Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

Object id visibility in QML

$
0
0
If A.qml is a composition in B.qml which is a composition in main.qml then A.qml can see and refer to all object id’s in B.qml as well as main.qml. Is doing so recommended as a good practice in qml world ? eg., //A.qml Rectangle {       //can see and use objRoot - see main.qml below }   //B.qml Item {      One {         id: one      }       A {     } }   //main.qml Rectangle {     id: objRoot       B {     } } An eg. when this could be required: A.qml has a drag-able component. Then when it is dragged we would need to call ParentChange to make objRoot the parent for the duration of the drag so that it remains a top level item, visible no matter where it’s dragged around the window. If this is not a good practice then what’s the alternative ?

Viewing all articles
Browse latest Browse all 4972

Latest Images

Trending Articles



Latest Images