Qt invoking qml function with custom QObject type

折月煮酒 提交于 2019-12-06 18:56:31

Since you seem to have registered everything correctly, you might be encounting a bug that sometimes happen with QML where objects seem to be stuck in a QVariant wrapping. Try the following and see if it work.

import com.mycustom 1.0

property QtObject temp

function(custom) {
    temp = custom;
    console.log(temp.ssid);
}

Sometimes forcing your instance to be a QtObject will remove the annoying "QVariant wrapper" and solve the issue.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!