EDIT: Sorry about the mess, I was hoping the code scrollbar would keep things neater than this...

Hello all,

I'm attempting to use QMetaObject to utilize reflection concepts to connect signals in one plugin system to slots in another plugin system that match naming conventions. The basic idea is that if an input plugin has a signal like mySignal*SIGNAL_NAME*(*ARGS*), then a slot in another plugin may or may not have a slot that matches, like so: mySlot*SLOT_NAME*(*ARGS*).

I've found that during run-time, QMetaObject Qt plugins do indeed find signals and slots that are not defined in the interface (which is exactly what I was looking for)... but to make the connections, I find that I'm getting warnings on the console that say the following:
Qt Code:
  1. Object::connect: Use the SIGNAL macro to bind evilcpcInputVoiceSignals::evilcpcSignalActivateDVD()
To copy to clipboard, switch view to plain text mode 

I'm using the following to make the connection:
Qt Code:
  1. . foreach(evilcpcInput * i, lPluginInput)
  2. { //For all input plugins
  3. evilcpcInputSignals * si = i->getSignals();
  4. const QMetaObject * imo = si->metaObject();
  5. foreach(mi, lPluginMenuItems)
  6. { //For all menu item plugins
  7. evilcpcMenuItemSlots * sl = mi->getSlots();
  8. const QMetaObject * mimo = sl->metaObject();
  9. for(int index(0); index < imo->methodCount(); index++)
  10. { //for all methods of the current input plugin
  11. if(imo->method(index).methodType() == QMetaMethod::Signal)
  12. { //if this method is a signal
  13. QString signalSignature = imo->method(index).signature();
  14. if(signalSignature.startsWith("evilcpcSignal", Qt::CaseSensitive))
  15. { //It's a legitimate signature
  16. QString signalName = signalSignature;
  17. signalName.remove(0, strlen("evilcpcSignal"));
  18. int position(signalName.indexOf('('));
  19. signalName.remove(position, signalName.length() - position);
  20. for(int index1(0); index1 < mimo->methodCount(); index1++)
  21. { //for all methods of the current menu item plugin
  22. if(mimo->method(index1).methodType() == QMetaMethod::Slot)
  23. { //if this method is a slot
  24. QString slotSignature = mimo->method(index1).signature();
  25. if(slotSignature.startsWith("evilcpcSlot", Qt::CaseSensitive))
  26. { //It's a legitimate slot
  27. QString slotName = slotSignature;
  28. slotName.remove(0, strlen("evilcpcSlot"));
  29. position = slotName.indexOf('(');
  30. slotName.remove(position, slotName.length() - position);
  31. if(signalName == slotName && imo->method(index).parameterTypes() == mimo->method(index1).parameterTypes())
  32. { //Signal matches slot, so connect them
  33. QObject::connect(si, signalSignature.toAscii().data(), sl, slotSignature.toAscii().data());
  34. std::cerr << "input plugin '" << i->getName().toAscii().data() << "' signal '" << signalSignature.toAscii().data() << "' connected to menu item plugin '" << mi->getName().toAscii().data() << "' slot '" << slotSignature.toAscii().data() << '\'' << std::endl;
  35. }
  36. }
  37. }
  38. }
  39. }
  40. }
  41. }
  42. }
  43. }
To copy to clipboard, switch view to plain text mode 
All my signatures look about right. How exactly should I be using connect, then?