首页| 论坛| 消息

标题:Qt信号与槽的connect方法参数的含义
作者:vechary
日期:2016-03-25 09:49
内容:

成员函数的指针作为信号和槽
static QMetaObject::Connection connect(
const QObject *sender,
PointerToMemberFunction signal,
const QObject *receiver,
PointerToMemberFunction method,
Qt::ConnectionType type = Qt::AutoConnection
);
成员函数作为信号,全局函数,lambda表达式等普通函数作为槽
static QMetaObject::Connection connect(
const QObject *sender,
PointerToMemberFunction signal,
Functor functor
);
TODO:context做什么用的?
static QMetaObject::Connection connect(
const QObject *sender,
PointerToMemberFunction signal,
const QObject *context,
Functor functor,
Qt::ConnectionType type = Qt::AutoConnection
);

最后一种重载中,connect(sender, signal, context, functor);
context是什么意思?应该如何传参?

回复 发表
主题 版块