博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
qml 一个信号与多个方法关联 和 c++信号与槽类似写法
阅读量:6902 次
发布时间:2019-06-27

本文共 975 字,大约阅读时间需要 3 分钟。

qml 一个信号与多个方法关联 和 c++信号与槽类似写法

import QtQuick 2.9import QtQuick.Window 2.2Window {    visible: true    width: 640    height: 480    title: qsTr("Hello World")    Rectangle{        id:relay        signal messageReceived(string person,string notice)        Component.onCompleted: {            relay.messageReceived.connect(sendToPost)            relay.messageReceived.connect(sendToTelegraph)            relay.messageReceived.connect(sendToEmail)            relay.messageReceived("xxx","yyy")        }        function sendToPost(person,notice){            console.log("send to post"+person +","+notice)        }        function sendToTelegraph(person,notice){            console.log("send to legraph"+person +","+notice)        }        function sendToEmail(person,notice){            console.log("send to email"+person +","+notice)        }    }}

结果:

qml: send to postxxx,yyy

qml: send to legraphxxx,yyy

qml: send to emailxxx,yyy

转载于:https://www.cnblogs.com/CQbk/p/9509705.html

你可能感兴趣的文章
CentOS6 运行级别
查看>>
抓取Nginx前20个访问IP
查看>>
python脚本删除n天前文件可用于windows,linux并且支持跨平台
查看>>
如何卸载win 7中无用的更新补丁包
查看>>
什么是最好的linux服务器管理系统
查看>>
完全卸载oracle
查看>>
汇编----指令(一)
查看>>
我的友情链接
查看>>
在虚拟机上安装centos7
查看>>
【C#】string.format 应用
查看>>
地图检索 – 与众不同
查看>>
nginx 配置实战:流量及并发连接数限制
查看>>
关于logrotate的额外补充
查看>>
我的友情链接
查看>>
图解自定义安装CentOS
查看>>
Xposed hook(android)
查看>>
vs设置异常就断下
查看>>
win7 共享打印机后,客户端连接提示:打印机已删除(0x00000709)
查看>>
工作与生活之平衡(4)微博病患者
查看>>
Andriod第七课-----数据库
查看>>