【发布时间】:2020-11-20 23:50:21
【问题描述】:
connect( &objTwo, &Two::emitThisSignal, this, &Controller::mySlot );
这里的 Two 是一个单独的类。它的对象已在 Controller 类中创建。它的信号必须连接到 Controller 类的插槽。
连接的签名是:
connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
connect(const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
connect(const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
connect(const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
我的连接调用代表上面的哪个签名?
为什么我不能简单地写:connect( &objTwo, objTwo.emitThisSignal, this, this->mySlot );?
【问题讨论】:
标签: c++ multithreading qt qthread