TouchSelectionMenuRequest QML Type

A request for showing a touch selection menu. More...

Import Statement: import QtWebEngine
Since: QtWebEngine 6.3

Properties

Detailed Description

A TouchSelectionMenuRequest is passed as an argument of the WebEngineView::touchSelectionMenuRequest signal. It provides further information about the context of the request. The selectionBounds property provides the origin of the request.

The accepted property of the request indicates whether the request is handled by the user code or the default touch selection menu should be displayed.

The following code uses a custom menu to handle the request:

 WebEngineView {
     id: view
     // ...
     onTouchSelectionMenuRequested: function(request) {
         request.accepted = true;
         myMenu.x = request.selectionBounds.x;
         myMenu.y = request.selectionBounds.y;
         myMenu.trigger.connect(view.triggerWebAction);
         myMenu.popup();
     }
     // ...
 }

Property Documentation

accepted : bool

Indicates whether the touch selection menu request has been handled by the signal handler.

If the property is false after any signal handlers for WebEngineView::touchSelectionMenuRequested have been executed, a default touch selection menu will be shown. To prevent this, set request.accepted to true.

The default is false.

Note: The default content of the touch selection menu depends on the web element for which the request was actually generated.


selectionBounds : rect [read-only]

The position of the bound rectangle from the touch text selection.