How to identify dynamic items in a mouseArea?
I have two questions regarding how dynamic items are handled in Qt Quick.
If I have many items, each with id item1, item2, item3, etc. If I drag one of the items into a mouseArea, how does the mouseArea identify which item is it? From the tutorials and examples, it seems like the item that is allowed to be in the mouseArea is pre-defined.
Can I create a new item on my GUI? E.g. can I create a new rectangle if I press a button in my GUI? And how does a mouseArea recognize a new item, when this new item is move over it?
Many thanks for your guidance.
- I think you are misunderstanding the purpose of drag.target. The drag.target in MouseArea is mostly for convenience and it is useful to make things such as sliders and scrollbar where only one predefined item is draggable. For fine grained control you can always use the onPositionChanged signal handler and to whatever you want.
- See this http://doc.qt.nokia.com/latest/qdeclarativedynamicobjects.html