Inspector+UI: Close inspector with shortcuts

This brings keyboard shortcuts for the inspector up with common
convention in FF and Chrome: Ctrl+Shift+C now also opens the inspector,
and F12, Ctrl+W, and Ctrl+Shift+I now close the inspector when the
inspector window is focused.

Resolves #972
This commit is contained in:
Tyler Dence 2024-12-03 18:32:43 -05:00 committed by Sam Atkins
commit 5cfed4524d
Notes: github-actions[bot] 2025-01-03 10:48:11 +00:00
5 changed files with 31 additions and 3 deletions

View file

@ -899,10 +899,23 @@ void Tab::recreate_toolbar_icons()
m_hamburger_button->setIcon(create_tvg_icon_with_theme_colors("hamburger", palette()));
}
void Tab::recreate_inspector()
{
if (m_inspector_widget)
m_inspector_widget->deleteLater();
m_inspector_widget = new InspectorWidget(this, view());
QObject::connect(m_inspector_widget, &InspectorWidget::closed, [this] {
m_inspector_widget->deleteLater();
m_inspector_widget = nullptr;
});
}
void Tab::show_inspector_window(InspectorTarget inspector_target)
{
if (!m_inspector_widget)
m_inspector_widget = new InspectorWidget(this, view());
recreate_inspector();
else
m_inspector_widget->inspect();