PDA

View Full Version : events interacting with signals/slots



gunhelstr
13th June 2006, 09:37
A simple excample:

A QlineEdit's lostFocus()-signal is connected to a slot in my class, who inherits QWidget.
The QLineEdit resides inside the same class.

While debugging my system, I experience that the slot is executed 3 times when the lineEdit looses focus. I would expect it to be called only ones.

I wonder if this has something to do with Qt's eventhandling? If so, how does this work?

I hope somebody can explaine this to me.

Beluvius
13th June 2006, 12:30
Hi,

I am no expert, but had a similar problem once or twice. The problem could be that you have multiple QLineEdits with the same name in your .ui files. For some reason, when multiple widgets exist with the same name, the slots are called multiple times. At least, that was the case at my place. My solve was to name all widgets unique in Qt.

Best Regards,
Beluvius