3

Is it possible to use QSignalMapper to re-emit signals with multiple parameters? I have found a workaround but im curious to know if it is possible.

example: take
void QLineEdit::textEdited ( const QString & text ) [signal]

and re-emit:

void newSignal(int group, int pos);

yan bellavance
  • 4,710
  • 20
  • 62
  • 93

1 Answers1

8

QSignalMapper can not be used for that, but the class is quite simple to re-implement and specialize for your needs. Simply use a QMap<QObject*,ValueStruct>, where ValueStruct keeps your arguments. When you receive a signal, map(), look at QObject::sender() (link) as the key in the map to make the emit in your turn.

e8johan
  • 2,899
  • 17
  • 20