ladybird/Ladybird/Qt/LocationEdit.h
Tim Ledbetter 808784092c UI/Qt: Don't show URL when a new tab is initially focused
The URL is now not shown when a new tab is initially activated until
the location bar loses focus. This allows the user to see the location
bar placeholder text when opening a new tab. It also makes it easier to
paste URLs into the location bar after opening a new tab.
2024-06-17 17:26:55 +02:00

38 lines
821 B
C++

/*
* Copyright (c) 2023, Cameron Youell <cameronyouell@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "AutoComplete.h"
#include <AK/OwnPtr.h>
#include <QLineEdit>
namespace Ladybird {
class LocationEdit final : public QLineEdit {
Q_OBJECT
public:
explicit LocationEdit(QWidget*);
URL::URL url() const { return m_url; }
void set_url(URL::URL const&);
bool url_is_hidden() const { return m_url_is_hidden; }
void set_url_is_hidden(bool url_is_hidden) { m_url_is_hidden = url_is_hidden; }
private:
virtual void focusInEvent(QFocusEvent* event) override;
virtual void focusOutEvent(QFocusEvent* event) override;
void highlight_location();
AK::OwnPtr<AutoComplete> m_autocomplete;
URL::URL m_url;
bool m_url_is_hidden { false };
};
}