From d1d6a204fc37ae4886cad660c53f5948666e5895 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filiph=20Sandstr=C3=B6m?= Date: Wed, 13 Jul 2022 04:39:38 +0200 Subject: [PATCH] Ladybird: Replace StatusBar with ToolTip This gives the actual webcontent more space to work with, it also emulates how other browsers does it. In the future we'd like to do something else since only ToolTip can be visible at the same time. --- Ladybird/BrowserWindow.cpp | 1 - Ladybird/Tab.cpp | 12 +++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Ladybird/BrowserWindow.cpp b/Ladybird/BrowserWindow.cpp index 553b1d037e..e4e78e24ed 100644 --- a/Ladybird/BrowserWindow.cpp +++ b/Ladybird/BrowserWindow.cpp @@ -10,7 +10,6 @@ #include #include #include -#include extern String s_serenity_resource_root; diff --git a/Ladybird/Tab.cpp b/Ladybird/Tab.cpp index eb37d2388e..bc24670b86 100644 --- a/Ladybird/Tab.cpp +++ b/Ladybird/Tab.cpp @@ -9,7 +9,8 @@ #include "BrowserWindow.h" #include "History.h" #include -#include +#include +#include extern String s_serenity_resource_root; @@ -48,8 +49,13 @@ Tab::Tab(QMainWindow* window) m_toolbar->addAction(m_home_action); m_toolbar->addWidget(m_location_edit); - QObject::connect(m_view, &WebView::linkHovered, m_window->statusBar(), &QStatusBar::showMessage); - QObject::connect(m_view, &WebView::linkUnhovered, m_window->statusBar(), &QStatusBar::clearMessage); + QObject::connect(m_view, &WebView::linkHovered, [this](QString const& title) { + const QPoint* pos = new QPoint(0, size().height() - 15); + QToolTip::showText(*pos, title, this); + }); + QObject::connect(m_view, &WebView::linkUnhovered, [this] { + QToolTip::hideText(); + }); QObject::connect(m_view, &WebView::loadStarted, [this](const URL& url) { m_location_edit->setText(url.to_string().characters());