Qt ---------- connect连接类型
|
Qt::AutoConnection |
0 |
(Default) If the receiver lives in the thread that emits the signal, Qt::DirectConnection is used. Otherwise, Qt::QueuedConnection is used. The connection type is determined when the signal is emitted. |
|
Qt::DirectConnection |
1 |
The slot is invoked immediately when the signal is emitted. The slot is executed in the signalling thread. |
|
Qt::QueuedConnection |
2 |
The slot is invoked when control returns to the event loop of the receiver's thread. The slot is executed in the receiver's thread. |
|
Qt::BlockingQueuedConnection |
3 |
Same as Qt::QueuedConnection, except that the signalling thread blocks until the slot returns. This connection must not be used if the receiver lives in the signalling thread, or else the application will deadlock. |
|
Qt::UniqueConnection |
0x80 |
This is a flag that can be combined with any one of the above connection types, using a bitwise OR. When Qt::UniqueConnection is set, QObject::connect() will fail if the connection already exists (i.e. if the same signal is already connected to the same slot for the same pair of objects). This flag was introduced in Qt 4.6. |
直接连接的大概意思是:信号一旦发射,槽立即执行,并且槽是在信号发射的线程中执行的。
队列连接的大概意思是:信号发射后,当事件循环返回到接收线程时槽函数就执行了,也就是说这种连接方式不是立即触发槽函数的,而是要排队等的,并且是在槽函数的线程中执行。
自动连接的大概意思是:信号发射对象如果和槽的执行对象在同一个线程,那么将是直连方式,否则就是队列方式。
阻塞队列方式:在槽函数返回之前信号发射所在的线程都是阻塞的。
Call qRegisterMetaType() to register the data type before you establish the connection。
另外信号槽的参数必须是注册的MetaType,所以当你使用自定义的类型或者 没有注册的类型,都要在connect连接语句前调用qRegisterMetaType()进行注册,因为Qt需要保存你的参数。
Qt ---------- connect连接类型的更多相关文章
- Qt动态连接库/静态连接库创建与使用,QLibrary动态加载库
版权声明:若无来源注明,Techie亮博客文章均为原创. 转载请以链接形式标明本文标题和地址: 本文标题:Qt动态连接库/静态连接库创建与使用,QLibrary动态加载库 本文地址:https ...
- Qt 串口连接
Qt 串口连接 使用 Qt 开发上位机程序时,经常需要用到串口,在 Qt 中访问串口比较简单,因为 Qt 已经提供了 QSerialPort 和 QSerialPortInfo 这两个类用于访问串口. ...
- Sort merge join、Nested loops、Hash join(三种连接类型)
目前为止,典型的连接类型有3种: Sort merge join(SMJ排序-合并连接):首先生产driving table需要的数据,然后对这些数据按照连接操作关联列进行排序:然后生产probed ...
- 小白学习mysql之优化基础(EXPLAIN的连接类型)
## 导语很多情况下,有很多人用各种select语句查询到了他们想要的数据后,往往便以为工作圆满结束了.这些事情往往发生在一些学生亦或刚入职场但之前又没有很好数据库基础的小白身上,但所谓闻道有先后,只 ...
- iphone判断当前网络连接类型
eachability只能区分出无网络.wifi和wwan(2G&2.5G&3G)类型的网络连接类型,只需重构networkStatusForFlags方法,即可详细区分出2G与3G网 ...
- Android 判断当前网络连接类型
实际应用开发时,如果存在需要用户获取大量数据的情况,最好是先判断下网络类型,提示用户当前的网络类型,是否需要连接Wifi,etc.(手机流量太贵啦,当然土豪是无视这玩意的, (/ □ \)). 定义网 ...
- Swift - 判端网络连接状态,连接类型(3G还是Wifi)
IJReachability是一个使用Swift写的第三方网络检测类.可以测试网络是否连接,并支持3G和Wifi的检测. 使用样例: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ...
- Unity判断网络连接类型
使用NetworkReachability判断手机游戏当前的网络连接类型,是wifi还是234G using UnityEngine; using System.Collections; public ...
- 【Android Developers Training】 86. 基于连接类型修改您的下载模式
注:本文翻译自Google官方的Android Developers Training文档,译者技术一般,由于喜爱安卓而产生了翻译的念头,纯属个人兴趣爱好. 原文链接:http://developer ...
随机推荐
- Java学习笔记-10.io流
1.输入流,只能从中读取数据,而不能向其写出数据.输出流,只能想起写入字节数据,而不能从中读取. 2.InputStream的类型有: ByteArrayInputStream 包含一个内存缓冲区,字 ...
- vmware centOS上网配置笔记
⦁ 修改/etc/sysconfig/network-scripts/ifcfg-eth0文件 (首先查看本机vmware 虚拟网络编辑器中的网关) 重启网络 使用命令:service net ...
- halcon安装提示could not write updated path to HKLM
halcon安装提示could not write updated path to HKLM 我们在安装Halcon软件时,会弹出如上图错误信息,这个错误信息提示软件无法写入本地注册表,造成这个原因有 ...
- 名人问题 算法解析与Python 实现 O(n) 复杂度 (以Leetcode 277. Find the Celebrity为例)
1. 题目描述 Problem Description Leetcode 277. Find the Celebrity Suppose you are at a party with n peopl ...
- 《剑指Offer》题三十一~题四十
三十一.栈的压入.弹出序列 题目:输入两个整数序列,第一个序列表示栈的压入顺序,请判断第二个序列是否为该栈的弹出顺序.假设压入栈的数字均不相等.例如,序列{1, 2, 3, 4 ,5}是某栈的压栈序列 ...
- 感谢信——Alpha版
作为Thunder团队的leader,当时担任组长,说实话,确实是头脑一热,可后来,在确定选题时,看着大家都有自己的想法,看着大家都那么踊跃,而我因为性格的原因,总是难以做决定,导致选题这件事就开了几 ...
- Pipeline组项目Postmortem
Pipeline组项目Postmortem 1. 设想和目标 1)目标我们的软件要解决什么问题?是否定义得很清楚?是否对典型用户和典型场景有清晰的描述? 我们的项目是学霸系统PipeLine, ...
- FromHandle临时对象一探究竟
我们在调用CWnd::GetDlgItem()函数时,MSDN告诉我们:The returned pointer may be temporary and should not be stored f ...
- MFC加速键
添加的函数: } // 解释说明 MFC对话框不自动处理加速键,你必须自己编写代码来做这件事情.为了理解弄清楚这是为什么,让我们回首Windows开发的历程,在使用C和原始的Windows ...
- wpf拖拽
简单拖拽的实现是,实现源控件的MouseDown事件,和目标控件Drop事件.调用DragDrop.DoDragDrop()以启动拖放操作,DragDrop.DoDragDrop()函数接受三个参数: ...