Ladybird: Add keyboard shortcut for focusing the location edit (Ctrl+L)

This commit is contained in:
Andreas Kling 2022-07-07 02:56:09 +02:00 committed by Andrew Kaster
parent 303fda074a
commit 50b3672f52
Notes: sideshowbarker 2024-07-17 02:49:01 +09:00

View file

@ -23,6 +23,10 @@ Tab::Tab(QMainWindow* window)
m_toolbar = new QToolBar;
m_location_edit = new QLineEdit;
auto* focus_location_edit_action = new QAction("Edit Location");
focus_location_edit_action->setShortcut(QKeySequence("Ctrl+L"));
addAction(focus_location_edit_action);
m_layout->addWidget(m_toolbar);
m_layout->addWidget(m_view);
@ -59,6 +63,8 @@ Tab::Tab(QMainWindow* window)
QObject::connect(m_forward_action, &QAction::triggered, this, &Tab::forward);
QObject::connect(m_home_action, &QAction::triggered, this, &Tab::home);
QObject::connect(m_reload_action, &QAction::triggered, this, &Tab::reload);
QObject::connect(focus_location_edit_action, &QAction::triggered, m_location_edit, qOverload<>(&QWidget::setFocus));
QObject::connect(focus_location_edit_action, &QAction::triggered, m_location_edit, &QLineEdit::selectAll);
}
void Tab::navigate(QString const& url)