mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 05:25:32 +03: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
Notes:
sideshowbarker
2024-07-19 01:59:31 +09:00
Author: https://github.com/cammo1123 Commit: https://github.com/SerenityOS/serenity/commit/b97f9f5809 Pull-request: https://github.com/SerenityOS/serenity/pull/17077 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/AtkinsSJ Reviewed-by: https://github.com/linusg ✅
@ -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 New Issue
Block a user