WebEngineAction QML Type
Una acción que representa un WebEngineView::WebAction. Más...
| Import Statement: | import QtWebEngine |
| Since: | QtWebEngine 1.8 |
Propiedades
Métodos
- void trigger()
Descripción detallada
Una WebEngineAction es devuelta por el método WebEngineView::action(). Proporciona información sobre la acción, como por ejemplo si es enabled.
El siguiente código utiliza el método WebEngineView::action() para comprobar si la acción de copia está activada:
var copyAction = webEngineView.action(WebEngineView.Copy); if (copyAction.enabled) console.log("Copy is enabled."); else console.log("Copy is disabled.");
Un ToolButton puede conectarse a un WebEngineAction de la siguiente manera:
ToolButton { property int itemAction: WebEngineView.Back text: webEngineView.action(itemAction).text enabled: webEngineView.action(itemAction).enabled onClicked: webEngineView.action(itemAction).trigger() icon.name: webEngineView.action(itemAction).iconName display: AbstractButton.TextUnderIcon }
Un menú contextual podría implementarse así:
property Menu contextMenu: Menu { Repeater { model: [ WebEngineView.Back, WebEngineView.Forward, WebEngineView.Reload, WebEngineView.SavePage, WebEngineView.Copy, WebEngineView.Paste, WebEngineView.Cut, WebEngineView.ChangeTextDirectionLTR, WebEngineView.ChangeTextDirectionRTL, ] MenuItem { text: webEngineView.action(modelData).text enabled: webEngineView.action(modelData).enabled onClicked: webEngineView.action(modelData).trigger() icon.name: webEngineView.action(modelData).iconName display: MenuItem.TextBesideIcon } } } onContextMenuRequested: function(request) { if (customContextMenuOption.checked) { request.accepted = true; contextMenu.popup(); } }
Documentación de propiedades
enabled : bool [read-only]
Esta propiedad indica si la acción está activada.
iconName : string [read-only]
Esta propiedad contiene el nombre del icono de la acción. Este nombre se puede utilizar para elegir el icono de un tema.
text : int [read-only]
Esta propiedad contiene una descripción textual de la acción.
Documentación del método
void trigger()
Activa la acción.
© 2026 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.