Hello,

Lets set this:

Qt Code:
  1. using namespace srps;
  2. bool SRPSMain::initialize()
  3. {
  4. QObject * obj = new Species;
  5. Species * sp = qobject_cast<Species*>( obj );
  6. sp->setObjectName("sp");
  7. qDebug() << obj << sp;
  8. connect( sp, SIGNAL(destroyed()), this, SLOT(deleted()) );
  9. sp->deleteLater();
  10. return true;
  11. }
  12.  
  13. void SRPSMain::deleted()
  14. {
  15. qDebug() << Q_FUNC_INFO << sender() << qobject_cast<Species*>( sender() );
  16. }
To copy to clipboard, switch view to plain text mode 

both classes are QObject direct subclases and have Q_OBJECT macro.

the output is:

Qt Code:
  1. srps::Species(0x82ab00, name = "sp") srps::Species(0x82ab00, name = "sp")
  2. void srps::SRPSMain::deleted() QObject(0x82ab00, name = "sp") QObject(0x0)
To copy to clipboard, switch view to plain text mode 

so, why the second qobject_cast does not work?

Thanks.