title: Qt is it possible to define a function pointer in place of a signal?
body: <p>I have a lot of signals which all have the same parameters but perform different functions.</p>
  
  <p>The connect and disconnect code for all the signals will be the same, as is the slot handler that the signals connect to.</p>
  
  <p>Instead of writing this code over and over. I would like to use a function pointer or something similar to assign to the signal, then have a common code block which performs the connection or disconnection.</p>
  
  <p>The following code is just to illustrate what I am describing, it isn't valid and will not compile.</p>
  
  <pre><code>    void (*pfnSignal)(quint8, QString);
      switch( eSigID ) {
      case SIGNAL_A:
          pfnSignal = signalA; 
          break;
      case SIGNAL_B:
          pfnSignal = signalB;
          break;
      default:
          pfnSignal = NULL;           
      }
      if ( pfnSignal != NULL ) {
        QObject::connect(pobjRef, pfnSignal, this, SLOT(handler(quint8, QString)));
      }
  </code></pre>