I have multiple QLineEdit
widgets on a configuration widget.
When the configuration text is changed I want to store the updated value (there are a few of them so I don't want to pass them in one function call at the end).
I was thinking to connect them to one slot or go through QSignalMapper
to one slot.
However I'm having trouble finding an elegant way to tell the QLineEdit
s apart, I want to know which QLineEdit emitted the signal - since I'm in handler object that implements the logic I can't compare the sender()
with the original object.
I can hook them up through QSignalMapper
so that my handler gets either int id
or QObject*
or QWidget*
reference to the actual widget that emitted the signal so I can get easily the new text, but I would like to be able to switch on some id to update the correct setting internally.
Is there any elegant way to tag or label Qt objects or widgets?
sender()
- could you clarify? – Matsender()
is myserverLineEdit
or other widget - it would be nice to be able to get some ID/tag/label that I could check (instead ofobjectName()
...). But maybe I'm not doing it correctly ... I could just send all values across to model when theapply
button is pressed ... but I was looking for something more elegant – stefanB