KGuiAddons and QGestures like tap/click-and-hold to open context menu?

David Faure faure at kde.org
Sun Mar 12 14:27:43 UTC 2017


On dimanche 12 mars 2017 09:03:51 CET René J.V. Bertin wrote:
> Hello,
> 
> The other day I had to add a context menu to a widget (QPushbutton) defined
> in a .ui file and went a bit further when I realised it could be nice to be
> able to open such a menu without using a right-click or menu button. After
> all, not all platforms have a (physical) right mouse button or a menu key;
> Macs come to mind but also mobile devices.
> 
> The usual way to open the context menu on such platforms is
> click/tap-and-hold - I think that was actually introduced in an early Mac
> OS X version.
> 
> With Qt's TapAndHold gesture this is actually not difficult to implement at
> all, see
> https://forum.qt.io/topic/46738/how-to-simulate-properly-an-long-click-on-t
> he-mouse-on-a-button-updated-with-full-code/10#
> 
> Would this be an idea to add to a framework like KGuiAddons?

Isn't this exactly what QToolButton::setMenu does?
(given that the default popupMode is DelayedPopup)

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5



More information about the Kde-frameworks-devel mailing list