[Qt-interest] QLineEdit - textChanged signal - determine old value
R. Reucher
rene.reucher at batcom-it.net
Mon Sep 14 15:05:25 CEST 2009
On Mon, 14 Sep 2009 13:39:25 +0100, Colin S. Miller wrote:
> Ender EREL wrote:
>> You can keep an internal QString storing the value whenever the text
>> changes. You can use that value to get the last text.
>>
>> void textChanged(const QString& newText) {
>> if(myOldText != newText)
>> {//Do Stuff
>> }
>>
>> myOldText = newText;
>> return;
>> }
> Ah. Thought it might be something like that. The problem is there are a
> large number of the QLineEdit controls which are are connected to the
> same slot.
>
> Is there any way for a derived instance of QLineEdit to tell when all
> the signal-slots have completed, so it can update its internal record of
> its old state to its current state?
When you derive from QLineEdit, you can connect the signal to "yourself",
do what Ender suggested (internally), and emit a new signal which may
contain the old and new texts.
> Or am I better keeping track of the focus change in the QLineEdits (I'm
> all ready doing this), and grabing the current (soon to be old) value of
> the control when a QLineEdit gains focus?
I don't think that's a better approach...
HTH, René
--
René Reucher
rene.reucher at batcom-it.net
http://www.batcom-it.net/
More information about the Qt-interest-old
mailing list