mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:37:35 +00:00
Ladybird: Add a location bar and allow navigating to new pages :^)
This commit is contained in:
parent
88d256c109
commit
8b7000e151
7 changed files with 60 additions and 18 deletions
27
Ladybird/BrowserWindow.cpp
Normal file
27
Ladybird/BrowserWindow.cpp
Normal file
|
@ -0,0 +1,27 @@
|
|||
#include "BrowserWindow.h"
|
||||
#include "WebView.h"
|
||||
#include <QStatusBar>
|
||||
|
||||
BrowserWindow::BrowserWindow()
|
||||
{
|
||||
m_toolbar = new QToolBar;
|
||||
m_toolbar->setFixedHeight(28);
|
||||
m_location_edit = new QLineEdit;
|
||||
m_toolbar->addWidget(m_location_edit);
|
||||
|
||||
addToolBar(m_toolbar);
|
||||
|
||||
m_view = new WebView;
|
||||
setCentralWidget(m_view);
|
||||
|
||||
QObject::connect(m_view, &WebView::linkHovered, statusBar(), &QStatusBar::showMessage);
|
||||
QObject::connect(m_view, &WebView::linkUnhovered, statusBar(), &QStatusBar::clearMessage);
|
||||
|
||||
QObject::connect(m_view, &WebView::loadStarted, m_location_edit, &QLineEdit::setText);
|
||||
QObject::connect(m_location_edit, &QLineEdit::returnPressed, this, &BrowserWindow::location_edit_return_pressed);
|
||||
}
|
||||
|
||||
void BrowserWindow::location_edit_return_pressed()
|
||||
{
|
||||
view().load(m_location_edit->text().toUtf8().data());
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue