Review Request 128858: [frameworks] Hide cursor when tablet pen leaves proximity of the screen

Oliver Sander oliver.sander at tu-dresden.de
Tue Oct 4 14:19:38 UTC 2016



> On Oct. 2, 2016, 12:33 p.m., Martin Tobias Holmedahl Sandsmark wrote:
> > maybe try with installEventFilter(qApp) in the presentation widget, override eventFilter() and check for the tablet events in PresentationWidget and call setCursor(Qt::BlankCursor) and unsetCursor().
> > 
> > you could also call setOverrideCursor() and unsetOverrideCursor() in your custom QApplication, but then it's tricky to track when the presentation widget is used and I'd prefer not having a new application class just for this.
> 
> Albert Astals Cid wrote:
>     What sandsmark says try installing an event filter, the syntax of what he suggested is wrong, what you want is not installEventFilter(qApp) but qApp->installEventFilter(this), with this being the presentationwidget.

Thanks guys.  I rewrote the patch, and it now uses eventFilter.  That's indeed much nicer!

In principle, the new patch does what it is supposed to do.  However, two problems remain:

a) I had to add code to the mouseMoveEvent class, to make the arrow cursor appear when the mouse is moved.
   Otherwise, after a TabletLeaveProximity event causes the cursor to disappear, moving the mouse will
   not make it reappear.  I don't think my solution is very elegant.  Do you guys know a better way?
   
b) When in drawing mode, upon removing the stylus from the screen, the cursor will briefly switch to an
   arrow cursor before disappearing.  That is because mouseReleaseEvent calls routeMouseDrawingEvent
   which calls slotChangeDrawingToolEngine which sets the arrow cursor.  Any ideas how to avoid this?
   
Thanks again for your help!


- Oliver


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/128858/#review99709
-----------------------------------------------------------


On Oct. 4, 2016, 2:19 p.m., Oliver Sander wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/128858/
> -----------------------------------------------------------
> 
> (Updated Oct. 4, 2016, 2:19 p.m.)
> 
> 
> Review request for Okular.
> 
> 
> Repository: okular
> 
> 
> Description
> -------
> 
> I am trying to fix the following papercut:  I regularly write on pdf files in presentation mode, using the pen that comes with my Lenovo ThinkPad Yoga.  When I approach the screen with the pen, the cursor appears, and it follows the pen tip during writing.  When I lift off the pen, the cursor stays on, and auto-hides only a few seconds later (because of Okular::Settings::EnumSlidesCursor::HiddenDelay).  As a consequence, the cursor frequently hides the last bits of what I have just written.  This is a nuisance, because I do this in front of an audience, and a lot of it is math (where every detail matters).
> 
> Ideally, the cursor would auto-hide when I lift the pen off the screen.  Luckily, Qt has an event for this: QEvent::TabletLeaveProximity.  Unluckily, the documentation says (http://doc.qt.io/qt-5/qtabletevent.html):
> 
> "TabletEnterProximity and TabletLeaveProximity events [...] are only sent to QApplication"
> 
> Therefore, this patch introduces a new class TabletApplication, which inherits from QApplication, and is used in main.cpp instead of QApplication.  The proximity events are really caught, and each time a short note is printed on the console.
> 
> Unfortunately, at this point I am stuck and need some help.  Apparently, I cannot control the cursor from a QApplication.  How do I get the information that a TabletProximity has been caught to the presentation widget? Maybe the answer is trivial, but I have very little Qt programming experience.  Thanks for your help!
> 
> 
> Diffs
> -----
> 
>   ui/presentationwidget.h 69574d2 
>   ui/presentationwidget.cpp c16d616 
> 
> Diff: https://git.reviewboard.kde.org/r/128858/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Oliver Sander
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/okular-devel/attachments/20161004/5d81890b/attachment.html>


More information about the Okular-devel mailing list