开发者

qml send a list/array from signal

开发者 https://www.devze.com 2023-03-03 17:10 出处:网络
how can i create an item that send signal with array of data(ar开发者_StackOverflow中文版ray of numbers),

how can i create an item that send signal with array of data(ar开发者_StackOverflow中文版ray of numbers), and read it from another item?....


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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号