Qml send list / array from signal

how can I create an element that sends a signal with an array of data (an array of numbers) and read it from another object? ....

+3
source share
1 answer

I don’t know what you want to do exactly, but here is an example:

import QtQuick 1.0

Item {
    // item with the data
    Item {
        id: otherItem
        property variant numbers: [11, 22, 33]
    }

    // declare signal
    signal mySignal(variant array);

    // send mySignal when component is ready
    Component.onCompleted: mySignal(otherItem.numbers);

    // signal handler
    onMySignal: console.log("mySignal: " + array)
}
+3
source

All Articles