介绍Qml子控件(
Main.qml
)重载父控件(Test.qml
)的foo
函数重载的使用方法。
Test.qml
初始化中执行 foo
函数,由于子控件重载了该函数即为执行子控件的 foo
函数。=====
Test { function foo() { console.log("=====") }}
import QtQuick 2.0
Item { Component.onCompleted: foo()
function foo() { console.log("+++++") }}
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有