[Development] Pointer Handlers will be Tech Preview in 5.10

J-P Nurmi jpnurmi at qt.io
Wed Sep 27 19:56:39 CEST 2017


On 27 Sep 2017, at 17:35, Shawn Rutledge <Shawn.Rutledge at qt.io<mailto:Shawn.Rutledge at qt.io>> wrote:


On 27 Sep 2017, at 16:52, J-P Nurmi <jpnurmi at qt.io<mailto:jpnurmi at qt.io>> wrote:

On 9 Aug 2017, at 14:10, Shawn Rutledge <Shawn.Rutledge at qt.io<mailto:Shawn.Rutledge at qt.io>> wrote:

[…] So far we only have

TapHandler - […]
DragHandler - […]
PinchHandler - […]



Hi Shawn,

Why are these types called “handlers”? Because we use term “event handler” for those methods that you override in C++? IMHO “handler” type names belong to the same category with “utils” and “helpers”, type names that you give to internal helper classes when you don’t bother coming up with better names. You have implemented a gesture framework with support for taps, pinches, drags, and swipes, so why not call these types “gestures”?

The gesture is what it handles.  The reason the object exists is to handle events.

 A TapHandler _handles_ the tap _gesture_.

(subject verb object)

If we just replace that one word with yours:

 A TapGesture handles the tap gesture.

doesn’t sound right to me.

Why?

The problem IMO is mainly that we have the habit of calling a Javascript block bound to a signal a handler.  E.g. a TapHandler could have an onTapped: { … } Javascript block, and what do you call that: the TapHandler's onTapped handler?  We could be more old-fashioned and start calling bound Javascript functions callbacks (they are just functions after all), but it's too hard to break the habit.  Or we could try to think of another unique noun with similar meaning for the handler classes.

To the point. :) We may use the handler term in many contexts, but what is a handler, really? Most Qt classes handle something, but I’m glad we don’t have too many handlers. I’m not saying the name doesn’t make sense. You could stick that suffix to almost any class and it would make sense, and that’s exactly why I put it in the same category with utils and helpers. I was just hoping we could have nicer names. That’s all. These things are commonly recognized as gestures.

Responder maybe, to use macOS terminology?

Maybe Recognizer, I think I like that.

Sounds familiar. Oh, QGestureRecognizer, QPinchGesture, QTapGesture, QSwipeGesture… :)

--
J-P Nurmi

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20170927/0112c2c8/attachment.html>


More information about the Development mailing list