title: Ruby's subclassing and Qt's signals/slots don't work together as expected
body: <p>When trying to work with Qt's signal/slot mechanisms over more than one level of inheritance, I ran into a problem: When my class does not directly inherit from QObject, signals and slots don't seem to work any more.</p>
  
  <p>The output of the following program illustrates the case:</p>
  
  <pre><code>require 'Qt'
  
  class A &lt; Qt::Object
    signals 'mySignal()'
    slots 'mySlot()'
  
    def initialize
      super()
      puts "This is the c'tor of A and I am a #{self.class}"
      connect(self, SIGNAL('mySignal()'), self, SLOT('mySlot()'))
      emit mySignal()
    end
  
    def mySlot
      puts "Signal received and I am a #{self.class}"
    end
  end
  
  class B &lt; A
    def initialize
      super()
    end
  end
  
  app = Qt::Application.new(ARGV)
  A.new
  B.new
  app.exec
  </code></pre>
  
  <p>The program yields</p>
  
  <pre>
  This is the c'tor of A and I am a A
  Signal received and I am a A
  This is the c'tor of A and I am a B
  </pre>
  
  <p>However, I would expect</p>
  
  <pre>
  This is the c'tor of A and I am a A
  Signal received and I am a A
  This is the c'tor of A and I am a B
  Signal received and I am a B
  </pre>
  
  <p>Qt' <a href="http://doc.trolltech.com/4.3/moc.html" rel="nofollow noreferrer">documentation</a> states, that it "[...] assumes that the first inherited class is a <strong>subclass</strong> of QObject.". Since B &lt; A &lt; QObject, I would expect that to be true.
  The according C++ program behaves as expected (although you cannot identify the type of an object in its c'tor in c++, but that is besides the point here).</p>
  
  <p>The question is: Why does the program not give the expected output?</p>