From 6c608bac659b7e39be52ffecd68ecd46172665bc Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Mon, 9 Sep 2024 23:06:11 +0100 Subject: [PATCH] UI/Qt: Don't change LocationEdit cursor position on right click Previously, right clicking highlighted text in the location bar would cause the current selection to be lost. --- Ladybird/Qt/LocationEdit.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Ladybird/Qt/LocationEdit.cpp b/Ladybird/Qt/LocationEdit.cpp index 0c5d5f5b12b..fdce39c2c5a 100644 --- a/Ladybird/Qt/LocationEdit.cpp +++ b/Ladybird/Qt/LocationEdit.cpp @@ -73,8 +73,11 @@ void LocationEdit::focusOutEvent(QFocusEvent* event) if (text().isEmpty()) setText(qstring_from_ak_string(m_url.serialize())); } - setCursorPosition(0); - highlight_location(); + + if (event->reason() != Qt::PopupFocusReason) { + setCursorPosition(0); + highlight_location(); + } } void LocationEdit::update_placeholder()