PDA

View Full Version : QObject::connect (fast)



baray98
21st February 2008, 23:01
I have a widget (QlineEdits) thats is used to update a string member of my struct, the trigger is the editingFinished() signal from the QLineEdit.

from the snippet below



myclass::updateString(void) // connected to the editingFinished()
{
myStruct.name /* which is a QString*/ = myLineEdit->text();
}

myclass::saveToFile(void)
{
finalStruct = myStruct;

save(finalStruct); // found that my finalStruct has the old data of myStruct
}



I run in debugging mode and found that updateString was performed after saveToFile, that is when i type in line edit then pressed save . My hunch is that the updateString connection was qued or delayed somehow, Now my question is how can i make a connection givine a the highest priority?

baray98

jpn
22nd February 2008, 06:30
Quoting Signals and Slots (http://doc.trolltech.com/4.3/signalsandslots.html#signals):

If several slots are connected to one signal, the slots will be executed one after the other, in an arbitrary order, when the signal is emitted.
You shouldn't rely on the order.