Search code examples
qtqt4signals-slots

QT Signal Slot Question


I have matrix of QLineEdits in a QGridLayout. I want to signal when one of QLineEdits' text changes. I can connect the signal to a slot but there is no way of knowing which QLineEdit was changed. I would like to send the row column number of QLineEdit but there is pass variables to a slot according nokia fourms.

I was wondering if any of you have any suggestions?

One way to do it is to compare old values to new values, but this is inefficient.

Thank You!


Solution

  • You could use the QSignalMapper class. This would allow you to do what you're asking.

    See also Advanced Signals and Slots Usage for more info and some examples.