diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-06-29 11:55:06 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-07-06 09:34:51 +0000 |
commit | 0cc881b5bf8a4a6da8277d5166da92a1675f4654 (patch) | |
tree | db798f94a0fd1e51ba99a1a74bb971ed74c9f6a4 /examples | |
parent | c0d5f7e6c10e56777b025b83a1fc53c610927714 (diff) |
Add WebAction to QML api
Adds WebActions matching QWebEnginePage to QQuickWebEngineView, this
makes it possible to support copy/paste on OS X, and makes it possible
to do rich text copy to clipboard on all platforms.
Change-Id: If43c1b2e8ae0496423f830cfe6b86e0fa1b8126e
Task-number: QTBUG-44289
Reviewed-by: Andras Becsi <andras.becsi@theqtcompany.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/webengine/quicknanobrowser/BrowserWindow.qml | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/examples/webengine/quicknanobrowser/BrowserWindow.qml b/examples/webengine/quicknanobrowser/BrowserWindow.qml index 0df17f0ee..e7ad621b1 100644 --- a/examples/webengine/quicknanobrowser/BrowserWindow.qml +++ b/examples/webengine/quicknanobrowser/BrowserWindow.qml @@ -38,8 +38,8 @@ ** ****************************************************************************/ -import QtQuick 2.1 -import QtWebEngine 1.1 +import QtQuick 2.2 +import QtWebEngine 1.3 import QtQuick.Controls 1.0 import QtQuick.Controls.Styles 1.0 import QtQuick.Layouts 1.0 @@ -100,14 +100,14 @@ ApplicationWindow { } } Action { - shortcut: "Ctrl+R" + shortcut: StandardKey.Refresh onTriggered: { if (currentWebView) currentWebView.reload() } } Action { - shortcut: "Ctrl+T" + shortcut: StandardKey.AddTab onTriggered: { tabs.createEmptyTab(currentWebView.profile) tabs.currentIndex = tabs.count - 1 @@ -116,7 +116,7 @@ ApplicationWindow { } } Action { - shortcut: "Ctrl+W" + shortcut: StandardKey.Close onTriggered: { if (tabs.count == 1) browserWindow.close() @@ -136,14 +136,51 @@ ApplicationWindow { onTriggered: currentWebView.zoomFactor = 1.0; } Action { - shortcut: "Ctrl+-" + shortcut: StandardKey.ZoomOut onTriggered: currentWebView.zoomFactor -= 0.1; } Action { - shortcut: "Ctrl+=" + shortcut: StandardKey.ZoomIn onTriggered: currentWebView.zoomFactor += 0.1; } + Action { + shortcut: StandardKey.Copy + onTriggered: currentWebView.triggerWebAction(WebEngineView.Copy) + } + Action { + shortcut: StandardKey.Cut + onTriggered: currentWebView.triggerWebAction(WebEngineView.Cut) + } + Action { + shortcut: StandardKey.Paste + onTriggered: currentWebView.triggerWebAction(WebEngineView.Paste) + } + Action { + shortcut: "Shift+"+StandardKey.Paste + onTriggered: currentWebView.triggerWebAction(WebEngineView.PasteAndMatchStyle) + } + Action { + shortcut: StandardKey.SelectAll + onTriggered: currentWebView.triggerWebAction(WebEngineView.SelectAll) + } + Action { + shortcut: StandardKey.Undo + onTriggered: currentWebView.triggerWebAction(WebEngineView.Undo) + } + Action { + shortcut: StandardKey.Redo + onTriggered: currentWebView.triggerWebAction(WebEngineView.Redo) + } + Action { + shortcut: StandardKey.Back + onTriggered: currentWebView.triggerWebAction(WebEngineView.Back) + } + Action { + shortcut: StandardKey.Forward + onTriggered: currentWebView.triggerWebAction(WebEngineView.Forward) + } + toolBar: ToolBar { id: navigationBar RowLayout { |