PDA

View Full Version : focusInEvent()



coderbob
24th December 2007, 05:24
I am reimplementing focusInEvent(QFocusEvent * event ) on a QTextEdit but seem to have lost the glowing edge (or visual marker that it has focus) in the process.

Do I need to pass the event on? or make another call in focusInEvent() to get the graphical cue?

Bob

EDIT: Side note, I am reimplementing the widget so I can signal to another widget when focus is grabbed. It appeared reimplementing it and catching the event was the only way to do this. Is there another way?

jogeshwarakundi
24th December 2007, 06:58
Yes, After you post your signal in focusInEvent() just invoke QTextEdit::focusInEvent(e). This shall do the required GUI thing for you.

coderbob
24th December 2007, 14:30
I knew it was something of the sort but just could not recall.

Thank you.

wysota
24th December 2007, 15:07
EDIT: Side note, I am reimplementing the widget so I can signal to another widget when focus is grabbed. It appeared reimplementing it and catching the event was the only way to do this. Is there another way?

How about QApplication::focusChanged() signal?

jogeshwarakundi
24th December 2007, 15:19
How about QApplication::focusChanged() signal?

but wysota, connecting to this signal would cause the slot to be invoked for every focus change, right? if that is the case, the slot should check every time that the newWidget is of the new custom type before notification. This would make things inefficient right?

jacek
24th December 2007, 20:35
This would make things inefficient right?
I don't think that it will be noticeable to the user. This slot isn't going to be called millions of times.

wysota
24th December 2007, 21:31
but wysota, connecting to this signal would cause the slot to be invoked for every focus change, right? if that is the case, the slot should check every time that the newWidget is of the new custom type before notification. This would make things inefficient right?

A single signal processing is heavier than the slot you are going to connect to it, so the overhead of actually calling the slot is minimal.