mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-22 17:31:58 -05:00
Ladybird: Make LocationEdit its own class
Also make return key behave more like other browsers when editing
This commit is contained in:
parent
926e61dec6
commit
b97f9f5809
5 changed files with 39 additions and 2 deletions
|
@ -83,6 +83,7 @@ set(SOURCES
|
|||
BrowserWindow.cpp
|
||||
ConsoleWidget.cpp
|
||||
InspectorWidget.cpp
|
||||
LocationEdit.cpp
|
||||
ModelTranslator.cpp
|
||||
Settings.cpp
|
||||
SettingsDialog.cpp
|
||||
|
|
16
Ladybird/LocationEdit.cpp
Normal file
16
Ladybird/LocationEdit.cpp
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Cameron Youell <cameronyouell@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "LocationEdit.h"
|
||||
#include "Tab.h"
|
||||
|
||||
LocationEdit::LocationEdit(Tab* tab)
|
||||
: QLineEdit(tab)
|
||||
{
|
||||
connect(this, &QLineEdit::returnPressed, this, [&] {
|
||||
clearFocus();
|
||||
});
|
||||
}
|
19
Ladybird/LocationEdit.h
Normal file
19
Ladybird/LocationEdit.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Cameron Youell <cameronyouell@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define AK_DONT_REPLACE_STD
|
||||
|
||||
#include <QLineEdit>
|
||||
|
||||
class Tab;
|
||||
|
||||
class LocationEdit final : public QLineEdit {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit LocationEdit(Tab*);
|
||||
};
|
|
@ -30,7 +30,7 @@ Tab::Tab(BrowserWindow* window, StringView webdriver_content_ipc_path)
|
|||
|
||||
m_view = new WebContentView(webdriver_content_ipc_path);
|
||||
m_toolbar = new QToolBar(this);
|
||||
m_location_edit = new QLineEdit(this);
|
||||
m_location_edit = new LocationEdit(this);
|
||||
|
||||
m_hover_label = new QLabel(this);
|
||||
m_hover_label->hide();
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#define AK_DONT_REPLACE_STD
|
||||
|
||||
#include "LocationEdit.h"
|
||||
#include "WebContentView.h"
|
||||
#include <Browser/History.h>
|
||||
#include <QBoxLayout>
|
||||
|
@ -55,7 +56,7 @@ private:
|
|||
|
||||
QBoxLayout* m_layout;
|
||||
QToolBar* m_toolbar { nullptr };
|
||||
QLineEdit* m_location_edit { nullptr };
|
||||
LocationEdit* m_location_edit { nullptr };
|
||||
WebContentView* m_view { nullptr };
|
||||
BrowserWindow* m_window { nullptr };
|
||||
Browser::History m_history;
|
||||
|
|
Loading…
Reference in a new issue