mercredi 1 janvier 2020

Qt: How to notify an object that a signal slot connection involving it has been established

I want to make obj_a emit signal_func() immediately after the establishment of the signal slot connection. My question is how can obj_a detect such a connection the moment it was established; does QObject::connect emit a signal when the connection is established?

//main function
int main( int argc, char ** 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...
  QCoreApplication app(argc, argv);
  QObject::connect( &obj_a, &A::signal_func, &obj_b, &B::slot_func ); //how can obj_a detect the establishment of this connection?
  app.exec();
}

Aucun commentaire:

Enregistrer un commentaire