From 06b2414d801eb47e046468541b82e3d05e64eb36 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Wed, 27 Jan 2016 13:23:28 +0100 Subject: [PATCH] Focus locationbar on startup if url of current tab is empty --- src/lib/app/browserwindow.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/lib/app/browserwindow.cpp b/src/lib/app/browserwindow.cpp index 1729e7efe..e9887f66f 100644 --- a/src/lib/app/browserwindow.cpp +++ b/src/lib/app/browserwindow.cpp @@ -226,7 +226,16 @@ void BrowserWindow::postLaunch() raise(); activateWindow(); - QTimer::singleShot(0, tabWidget()->tabBar(), SLOT(ensureVisible())); + QTimer::singleShot(0, this, [this]() { + // Scroll to current tab + tabWidget()->tabBar()->ensureVisible(); + + // Update focus + if (locationBar()->text().isEmpty()) + locationBar()->setFocus(); + else + weView()->setFocus(); + }); } void BrowserWindow::setupUi()