A way to disable the long-left mouse click shortcut to enter "Edit Mode" / modifying widgets?

René J.V. Bertin rjvbertin at gmail.com
Mon Aug 15 13:05:09 BST 2022


On Monday August 15 2022 13:37:38 René J.V. Bertin wrote:
> /*!
> 
>     Set the timeout, in milliseconds, before the gesture triggers.
>     
>     The recognizer will detect a touch down and if \a msecs
>     later the touch is still down, it will trigger the QTapAndHoldGesture.
>     The default value is 700 milliseconds.
> 
> */
> void QTapAndHoldGesture::setTimeout(int msecs)
> {
> 
>     QTapAndHoldGesturePrivate::Timeout = msecs;
> 
> }

NB: the timeout appears to be a global parameter, not something that can be varied so you cannot have different timeouts on tap-and-hold gestures (on different objects, for instance) in a single application.

That means it *should* be possible to inject an override that sets the timeout to some sufficiently long duration so you don't trigger the gesture by accident but can still trigger it if you want to.
That would be done by a simple call to QTapAndHoldGesture::setTimeout(); a good place to do that would be in a widget style. Those are typically not very complicated to build (and distros usually make it easy to install the build dependency of any of their packages).

@Duncan: in what part of the code did you see the implementation? I put my own implementation in the KdePlatformTheme class which is one of the rare places where it gets exposed to just about any Qt application with a GUI. If the Plasma implementation is in a similar package (the plasma-framework isn't the most complex or expensive to build) it would be almost just as easy to disable the feature or set that timeout there.

R.


More information about the kde mailing list