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
parent a24718cc49
commit 5cfed4524d
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();