Reputation: 5073
I have many QLineEdit
's in my Main Window. I have a connected the editingFinished()
SIGNAL
of each object to a single SLOT
in my QMainWindow
class.
I want to implement my own Undo/Redo functionality. I find the Qt Undo framework pretty difficult to understand & complex to implement.
So I want to maintain a QList <QLineEdit *> undoList;
which will store the sequence of QLineEdit
's which were modified. I am maintaining an int
variable to keep track of current state. When Undo/Redo is done I can simply update the int
variable & find the QLineEdit
which was edited at that state & then call undo()
on that QLineEdit
.
Currently my biggest problem is that since I have connected all my QLineEdit
's to a single SLOT
, I have no information as to which QLineEdit
emitted that SIGNAL
.
So I would like to know if there is any way by which I can understand which QLineEdit
emitted the SIGNAL
.
Thank You.
Upvotes: 2
Views: 793
Reputation: 22346
Use sender()
inside the slot to get the the QObject
that emitted the signal connected to it.
Upvotes: 8