Qt:如何通知对象涉及它的信号槽连接已经建立
Qt: How to notify an object that a signal slot connection involving it has been established
我想让obj_a在建立信号槽连接后立即发出signal_func()。我的问题是 obj_a 如何在建立时检测到这种连接? QObject::connect 会在建立连接时发出信号吗?
//main function
int main( int argc, char ** argv )
{
QCoreApplication app(argc, argv);
A obj_a; //A is a child class of QObject
B obj_b; //B is a child class of QObject
// initialize obj_a, obj_b...
QObject::connect( &obj_a, &A::signal_func, &obj_b, &B::slot_func ); //how can obj_a detect the establishment of this connection?
app.exec();
}
我想让obj_a在建立信号槽连接后立即发出signal_func()。我的问题是 obj_a 如何在建立时检测到这种连接? QObject::connect 会在建立连接时发出信号吗?
//main function
int main( int argc, char ** argv )
{
QCoreApplication app(argc, argv);
A obj_a; //A is a child class of QObject
B obj_b; //B is a child class of QObject
// initialize obj_a, obj_b...
QObject::connect( &obj_a, &A::signal_func, &obj_b, &B::slot_func ); //how can obj_a detect the establishment of this connection?
app.exec();
}