summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2017-05-04 12:03:47 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2017-05-04 13:05:23 +0000
commit8ed45ab8997757ddd98ea8132f0a9bb3ad26e52a (patch)
tree4fb321f1852a617c6f64210c225ea72df69fba08
parentce5d960aee8876fc3b879b98cf4699f3e131f4b7 (diff)
SimpleBrowser: Press Ctrl-L to focus the location bar
This commonly used short cut is a must-have for every browser, even simple ones. Change-Id: I2a0bde05bceeb5a4334e3a7168bd45a9335311ee Reviewed-by: Kai Koehne <kai.koehne@qt.io>
-rw-r--r--examples/webenginewidgets/simplebrowser/browserwindow.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/examples/webenginewidgets/simplebrowser/browserwindow.cpp b/examples/webenginewidgets/simplebrowser/browserwindow.cpp
index c01f912d..762d56c8 100644
--- a/examples/webenginewidgets/simplebrowser/browserwindow.cpp
+++ b/examples/webenginewidgets/simplebrowser/browserwindow.cpp
@@ -105,6 +105,13 @@ BrowserWindow::BrowserWindow(QWidget *parent, Qt::WindowFlags flags)
m_urlLineEdit->setFavIcon(QIcon(QStringLiteral(":defaulticon.png")));
+ QAction *focusUrlLineEditAction = new QAction(this);
+ addAction(focusUrlLineEditAction);
+ focusUrlLineEditAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_L));
+ connect(focusUrlLineEditAction, &QAction::triggered, this, [this] () {
+ m_urlLineEdit->setFocus(Qt::ShortcutFocusReason);
+ });
+
handleWebViewTitleChanged(tr("Qt Simple Browser"));
m_tabWidget->createTab();
}