DAWorkbench 0.0.1
DAWorkbench API
载入中...
搜索中...
未找到
DA::DAPythonSignalHandler类 参考

Python线程到Qt主线程的通信处理器 更多...

#include <DAPythonSignalHandler.h>

类 DA::DAPythonSignalHandler 继承关系图:

class  FunctionWrapper
 

Public 类型

using FunctionWrapperPtr = std::shared_ptr< FunctionWrapper >
 

信号

void executeRequested (int funcWrapperId)
 内部信号,用于触发主线程执行
 

Public 成员函数

 DAPythonSignalHandler (QObject *parent=nullptr)
 
 DAPythonSignalHandler (const DAPythonSignalHandler &)=delete
 
DAPythonSignalHandleroperator= (const DAPythonSignalHandler &)=delete
 
void callInMainThread (std::function< void() > func)
 从Python线程调用,请求在主线程执行函数
 
void clearPendingFunctions ()
 清理所有待执行的函数
 

详细描述

Python线程到Qt主线程的通信处理器

这个类允许Python线程通过信号槽机制安全地调用Qt主线程中的函数 非单例模式,由主窗口或其他容器管理生命周期

成员函数说明

◆ callInMainThread()

void DA::DAPythonSignalHandler::callInMainThread ( std::function< void() >  func)

从Python线程调用,请求在主线程执行函数

参数
func要在主线程执行的函数

这个函数是线程安全的,可以从任何线程调用

◆ clearPendingFunctions()

void DA::DAPythonSignalHandler::clearPendingFunctions ( )

清理所有待执行的函数

在主窗口销毁前调用,确保所有函数都被清理

◆ executeRequested

void DA::DAPythonSignalHandler::executeRequested ( int  funcWrapperId)
signal

内部信号,用于触发主线程执行

参数
funcWrapperId函数包装器的唯一ID

该类的文档由以下文件生成: