dan
dan

Reputation: 229

qml send a list/array from signal

how can i create an item that send signal with array of data(array of numbers), and read it from another item?....

Upvotes: 3

Views: 3706

Answers (1)

hiddenbit
hiddenbit

Reputation: 2243

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)
}

Upvotes: 3

Related Questions