diff options
Diffstat (limited to 'lib/addressbar/urllineedit.cpp')
-rw-r--r-- | lib/addressbar/urllineedit.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/addressbar/urllineedit.cpp b/lib/addressbar/urllineedit.cpp index edbe327..6af6cf5 100644 --- a/lib/addressbar/urllineedit.cpp +++ b/lib/addressbar/urllineedit.cpp @@ -101,12 +101,26 @@ void UrlLineEdit::updateCompleter(const QStringList &l) void UrlLineEdit::focusInEvent(QFocusEvent *event) { + // a context menu event also causes a focusInEvent, so if text is selected + // skip the formatting step + if(event->reason() == Qt::PopupFocusReason) { + QLineEdit::focusInEvent(event); + return; + } + clearTextFormat(); QLineEdit::focusInEvent(event); } void UrlLineEdit::focusOutEvent(QFocusEvent *event) { + // a context menu event causes a focusOutEvent, and setUrl will clear the + // selection, and this would prevent the menu from working properly + if(event->reason() == Qt::PopupFocusReason) { + QLineEdit::focusOutEvent(event); + return; + } + const QUrl url = QUrl::fromUserInput(text()); if(url.isValid()) setUrl(url); |