aboutsummaryrefslogtreecommitdiff
path: root/lib/addressbar/urllineedit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/addressbar/urllineedit.cpp')
-rw-r--r--lib/addressbar/urllineedit.cpp16
1 files changed, 4 insertions, 12 deletions
diff --git a/lib/addressbar/urllineedit.cpp b/lib/addressbar/urllineedit.cpp
index 21f88eb..33bc9dc 100644
--- a/lib/addressbar/urllineedit.cpp
+++ b/lib/addressbar/urllineedit.cpp
@@ -22,6 +22,8 @@ UrlLineEdit::UrlLineEdit(QWidget *parent)
setPlaceholderText(tr("Enter address"));
m_listView->setVisible(false);
+ connect(m_listView, &Completer::completionActivated, this, &UrlLineEdit::setText);
+
auto *addressbar = qobject_cast<AddressBar *>(parent);
Q_CHECK_PTR(addressbar);
@@ -120,18 +122,8 @@ void UrlLineEdit::focusOutEvent(QFocusEvent *event)
void UrlLineEdit::keyPressEvent(QKeyEvent *event)
{
if(m_listView->keyPressed(event)) {
- int key = event->key();
- QModelIndex currentIndex = m_listView->currentIndex();
-
- if(key == Qt::Key::Key_Enter || key == Qt::Key_Return) {
-
- if(currentIndex.isValid()) {
- setText(currentIndex.data().toString());
- }
- m_listView->hide();
- event->accept();
- return;
- }
+ event->accept();
+ return;
} else if(event->key() == Qt::Key::Key_Escape) {
clearFocus();
event->accept();