Qt 信号槽断开连接的几种方式

方法1:完整参数

cpp 复制代码
if(ptr)
{
	//qt 4.8.6写法
    disconnect(ptr, SIGNAL(signalPtr()), this, SLOT(onSignalPtr()));
}

方法2:只指定发送者和信号

cpp 复制代码
if(ptr)
{
    disconnect(ptr, SIGNAL(signalPtr()), 0, 0);
}

方法3:断开所有连接

cpp 复制代码
if(ptr)
{
    disconnect(ptr, 0, 0, 0);  // 断开ptr的所有连接
}

方法4:只指定发送者和接收者

cpp 复制代码
if(ptr)
{
    disconnect(ptr, 0, this, 0);  // 断开modelPlace和this之间的所有连接
}
相关推荐
用户805533698033 天前
不止三件套:QObject 属性系统全关键字与运行时反射!
c++·qt
xcyxiner3 天前
DicomViewer (vcpkg Windows和ubuntu编译)7
qt
Quz8 天前
QML Hello World 入门示例
qt
xcyxiner11 天前
DicomViewer (dcmtk读取dcm文件)5
qt
xcyxiner11 天前
DicomViewer (后台线程处理文件)4
qt
xcyxiner12 天前
DicomViewer (添加模型类)3
qt
xcyxiner13 天前
DicomViewer (目录调整) 2
qt
xcyxiner13 天前
dcmtk vtk vtk-dicom(gdcm) 编译(debug) v2
qt
LDR00614 天前
Type-C 快充全面升级!LDR6601 赋能个人护理便携电机,重塑剃须刀 / 理发器新体验
c语言·开发语言
雪碧聊技术14 天前
Tree.js是什么?一文讲透
开发语言·javascript·ecmascript