Can QSignalMapper be used to re-emit signals with multiple parameters?
Is it possible to use QSignalMapper to re-emit signals with multiple parameters? I have found a workaround but i开发者_Go百科m 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);
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.
精彩评论