mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
UI/Qt: Add standard shortcuts for find in page actions
This commit adds the standard shortcuts for the Find Next and Find Previous buttons on the find in page panel. These shortcuts are usually F3 and Shift+F3 respectively, although Qt standard shortcuts may vary across platforms.
This commit is contained in:
committed by
Andreas Kling
parent
fdacf8ebeb
commit
88d134a4da
@@ -157,6 +157,20 @@ BrowserWindow::BrowserWindow(Vector<URL::URL> const& initial_urls, WebView::Cook
|
||||
m_find_in_page_action->setIcon(load_icon_from_uri("resource://icons/16x16/find.png"sv));
|
||||
m_find_in_page_action->setShortcuts(QKeySequence::keyBindings(QKeySequence::StandardKey::Find));
|
||||
|
||||
auto find_previous_shortcuts = QKeySequence::keyBindings(QKeySequence::StandardKey::FindPrevious);
|
||||
for (auto const& shortcut : find_previous_shortcuts)
|
||||
new QShortcut(shortcut, this, [this] {
|
||||
if (m_current_tab)
|
||||
m_current_tab->find_previous();
|
||||
});
|
||||
|
||||
auto find_next_shortcuts = QKeySequence::keyBindings(QKeySequence::StandardKey::FindNext);
|
||||
for (auto const& shortcut : find_next_shortcuts)
|
||||
new QShortcut(shortcut, this, [this] {
|
||||
if (m_current_tab)
|
||||
m_current_tab->find_next();
|
||||
});
|
||||
|
||||
edit_menu->addAction(m_find_in_page_action);
|
||||
QObject::connect(m_find_in_page_action, &QAction::triggered, this, &BrowserWindow::show_find_in_page);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user