A request for showing a touch selection menu. 更多...
import 语句: | import QtWebEngine |
Since: | QtWebEngine 6.3 |
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(); } // ... }
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
.
默认为
false
.
注意: The default content of the touch selection menu depends on the web element for which the request was actually generated.
selectionBounds
:
rect
|
The position of the bound rectangle from the touch text selection.