TouchSelectionMenuRequest QML Type
请求显示触摸选择菜单。更多
Import Statement: | import QtWebEngine |
Since: | QtWebEngine 6.3 |
属性
- accepted : bool
- selectionBounds : rect
详细说明
TouchSelectionMenuRequest 作为 WebEngineView::touchSelectionMenuRequest 信号的参数传递。它提供了有关请求上下文的更多信息。selectionBounds 属性提供了请求的来源。
请求的accepted 属性表示该请求是由用户代码处理还是显示默认的触摸选择菜单。
以下代码使用自定义菜单来处理请求:
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 |
表示触摸选择菜单请求是否已由信号处理程序处理。
如果在执行WebEngineView::touchSelectionMenuRequested 的任何信号处理程序后,属性为false
,则将显示默认触摸选择菜单。为防止出现这种情况,请将request.accepted
设置为true
。
默认值为false
。
注: 触摸选择菜单的默认内容取决于实际生成请求的网络元素。
selectionBounds : rect |
触摸文本选择时绑定矩形的位置。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.