title: Determining object types in Qt
body: <p>I have a series of QTextEdits and QLineEdits connected to a slot through a QSignalMapper(which emits a textChanged(QWidget*) signal). When the connected slot is called (pasted below), I need to be able to differentiate between the two so I know whether to call the text() or toPlainText() function. What's the easiest way to determine the subclass type of a QWidget? </p>
  
  <pre><code>void MainWindow::changed(QWidget *sender)
  {                   
     QTextEdit *temp = qobject_cast&lt;QTextEdit *&gt;(sender);
     QString currentText = temp-&gt;toPlainText(); // or temp-&gt;text() if its 
                                                // a QLineEdit...
     if(currentText.compare(""))
     {
        ...
     }
     else
     {
        ...
     }
  }
  </code></pre>
  
  <p>I was considering using try-catch but Qt doesn't seem to have very extensive support for Exceptions... Any ideas?</p>