开发者

Can QSignalMapper be used to re-emit signals with multiple parameters?

开发者 https://www.devze.com 2022-12-14 19:34 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消