diff options
author | Zeno Albisser <zeno.albisser@digia.com> | 2014-01-31 17:24:40 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-10 21:36:04 +0100 |
commit | 331b7fa11c84107e3300b14ece5fc5991cfc35e9 (patch) | |
tree | 6f47e11a32de6ef190667d0c12d92f9649e16b03 /examples | |
parent | 28acdd2ad14d3a5fecc51b5b4bc9d05b6f80dbb5 (diff) |
Add TakeFocus in WebContentsViewQt for passing on tab focus.
Chromium calls RenderViewHostDelegate::TakeFocus when the
last focusable item within the page was reached.
We then have to move the focus on to the next/previous
QQuickItem.
Change-Id: Id0128053602ff1220c1bced1b218050b66fef659
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/quick/quicknanobrowser/quickwindow.qml | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/examples/quick/quicknanobrowser/quickwindow.qml b/examples/quick/quicknanobrowser/quickwindow.qml index 63f86458e..88fc9f8a0 100644 --- a/examples/quick/quicknanobrowser/quickwindow.qml +++ b/examples/quick/quicknanobrowser/quickwindow.qml @@ -44,6 +44,7 @@ import QtWebEngine.experimental 1.0 import QtQuick.Controls 1.0 import QtQuick.Controls.Styles 1.0 import QtQuick.Layouts 1.0 +import QtQuick.Controls.Private 1.0 ApplicationWindow { id: browserWindow @@ -55,6 +56,12 @@ ApplicationWindow { visible: true title: tabs.currentView && tabs.currentView.title + // Create a styleItem to determine the platform. + // When using style "mac", ToolButtons are not supposed to accept focus. + StyleItem { id: styleItem } + property bool platformIsMac: styleItem.style == "mac" + + Action { id: focus shortcut: "Ctrl+L" @@ -94,17 +101,20 @@ ApplicationWindow { iconSource: "icons/go-previous.png" onClicked: tabs.currentView.goBack() enabled: tabs.currentView && tabs.currentView.canGoBack + activeFocusOnTab: !browserWindow.platformIsMac } ToolButton { id: forwardButton iconSource: "icons/go-next.png" onClicked: tabs.currentView.goForward() enabled: tabs.currentView && tabs.currentView.canGoForward + activeFocusOnTab: !browserWindow.platformIsMac } ToolButton { id: reloadButton iconSource: tabs.currentView && tabs.currentView.loading ? "icons/process-stop.png" : "icons/view-refresh.png" onClicked: tabs.currentView && tabs.currentView.loading ? tabs.currentView.stop() : tabs.currentView.reload() + activeFocusOnTab: !browserWindow.platformIsMac } TextField { id: addressBar |