no that part is clear to me. As I wrote in the comments to the code manipulating the delegate item's state is easy. How do you add a behaviour? eg.,
SomeComponent {
m_mouseProperty.onClicked: {
//add behaviour
}
}
SomeComponent {
m_mouseProperty.onClicked: {
//add behaviour
}
}
To copy to clipboard, switch view to plain text mode
here in SomeComponent.qml the component could already have implemented some behaviours on onClicked. What I believe I've done above is added to that behaviour so that in addition to all that it was doing on onClicked it will also do whatever it is asked to in above code. The question is can I somehow achieve this in delegate of a repeater (of a Column in this eg.):
Generic.qml
Column {
property alias m_delegate: objRepeater.delegate
property alias m_count: objRepeater.model
Repeater {
id: objRepeater
}
}
Column {
property alias m_delegate: objRepeater.delegate
property alias m_count: objRepeater.model
Repeater {
id: objRepeater
}
}
To copy to clipboard, switch view to plain text mode
Now if I use Generic.qml it should add a behaviour to the component supplied as a delegate:
Generic {
m_delegate: SomeItemWith_m_mouseProperty
m_count: 5
}
Generic {
m_delegate: SomeItemWith_m_mouseProperty
m_count: 5
}
To copy to clipboard, switch view to plain text mode
now Generic should be able to add behaviour to m_mouseProperty (which is an alias to MouseArea in this eg.)
onM_delegateChanged: {
children[index].m_mouseProperty.onClicked: {
//Add behaviour...ie., Do something
}
}
onM_delegateChanged: {
children[index].m_mouseProperty.onClicked: {
//Add behaviour...ie., Do something
}
}
To copy to clipboard, switch view to plain text mode
this ofcourse gives an error. So i can modify the state (children[index].m_someProperty = false is perfectly legal) but can I also add behaviour (say on onClicked) like in the example above?
Bookmarks