title: How to do Q_INTERFACES with PyQt? (Goal: Implement QTextObjectInterface)
body: <p>I'm trying to implement something similar to Cocoa's NSTokenField with Qt, by placing objects with custom rendering in a QTextEdit.</p>
  
  <p>Qt's text system allows for this by implementing a subclass of QTextObjectInterface to encapsulate the custom drawing code. However, in addition to subclassing, the class also has to make the interface it implements known to the meta-object system. In C++, this is done via the Q_INTERFACES macro in the header:</p>
  
  <p>Q_INTERFACES(QTextObjectInterface)</p>
  
  <p>I've looked at moc's output for a C++ prototype, and what it ends up doing is to generate a qt_metacast() implementation that does something useful for the interface name.</p>
  
  <p>I can't find a way to emulate this using PyQt. Any ideas?</p>