auto-hide feature in KTextEdit does not shown the mouse pointer again on mouse moves

David Faure faure at
Thu Aug 9 22:35:30 BST 2007

On Monday 06 August 2007, Nico Kruber wrote:
> I noticed that once the mouse pointer is hidden within a KTextEdit it is not 
> shown again by moving the mouse alone as it was described and should probably 
> work.
> I tried to look into this and figured that mouse events in a QTextEdit are 
> handled by its viewport and send to the specific QTextEdit::mouseMoveEvent() 
> etc. methods but not processed any further so installing an event filter on 
> the KTextEdit does not get the mouse events. Installing it on its viewport 
> does not help either because this one does not get key events so the cursor 
> is not hidden by them.
> I tried reimplementing the viewportEvent() method and call 
> KCursor::autoHideEventFilter() manually from there but this method always 
> complained about that an event filter was not applied yet ( there probably is 
> already an event before the "KCursor::setAutoHideCursor( this, true, 
> false );" in the constructors ).
> My final fix was to install an event filter on the viewport and call it from 
> there. I put the eventfilter() method into the KTextEdit class - probably not 
> the right way you want it to be, but I don't know where else without creating 
> a new class which kinda seems unnecessary for one method.
> I hope this helps resolving this issue - there might be more classes which 
> need that modification in order to get the auto-hide function working - and I 
> also hope I got the right mailing list.

From your patch, I would say the bug is in KCursor. It should handle scrollareas
all by itself, without the need for such a change in the widget itself (e.g. KTextEdit).

I didn't test the attached patch, but how about something like this?
Or do you think that both the widget and the viewport need an event filter
because some events are sent to one and some events are sent to the other?
That's quite possible... But in that case, too, the fix has to be done inside KCursor[PrivateAutoHideEventFilter],
not inside KTextEdit.


David Faure, faure at, sponsored by Trolltech to work on KDE,
Konqueror (, and KOffice (
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kcursor.diff
Type: text/x-diff
Size: 1568 bytes
Desc: not available
URL: <>

More information about the kde-core-devel mailing list