PDA

View Full Version : QAbstractItemView::entered signal, where is QAbstractItemView::left signal ?



topoden
26th November 2009, 19:02
Hello guys,

I need to do custom processing for and item every time when mouse enters the visible region of an item. Also I need to do some processing when the item is left by the mouse. I found QAbstractItemView::entered signal, which looks exactly what I want. However I could not find corresponding QAbstractItemView::left signal.

I've done some searching and found people suggested to remember current item and do the "leave event" processing for current item each time when the mouse enters visible region of the other item. This unfortunately does not work for me, because if mouse leaves an item it does not always mean that it enters the other item. It is possible for me that there is no current item at all.

How can I do this ? Please help.

squidge
26th November 2009, 19:10
Set an event filter on the widget and look for QEvent::Leave event? You could even subclass the view and implement that in the class so it can fire a Leave or Left signal.

topoden
26th November 2009, 19:21
Set an event filter on the widget and look for QEvent::Leave event? You could even subclass the view and implement that in the class so it can fire a Leave or Left signal.

Thats true, but in this case I will have to implement the logic which actually maps event->point() into the QModelIndex. I guess its not very hard task, but anyways. If they have put QAbstractItemView::entered(QModelIndex) event what were their points not to put corresponding leave event ? I'm sure there were some points, probably its possible to emulate the signal by using all other QAbstractItemView signals ?

topoden
26th November 2009, 19:28
It looks that when you leave an item QAbstractItemView::viewportEntered signal is emitted. So thanks all, the problem is resolved (they could put some comments about this in documentation though, its not so obvious)