Important: Please read the Qt Code of Conduct -

Pass item into signal as an argument.

  • Hi

    I've got something like that:

    @Item {
    id: root

    signal dragging(variant item, point mousePosition)


    MouseArea {
    onPositionChanged: {
    root.dragging(root, Qt.point(mouseX, mouseY));

    So, here is my question, in your opinion is it a good idea to pass the item itself into a signal, or would be better to introduce some kind of uuid(a primitive type) for items and pass them?

    Thanks a lot,

  • Moderators

    QML does not copy the object when sending, all it's doing is to send the object ID (or memory address, I don't remember atm). So there is no need to devise any custom UUID scheme: it's already there.

  • Sierdzio, thanks a lot!!!

Log in to reply