From 60f46cd8b154a2ad584d072481ff00d6fa23b2f1 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Mon, 8 Jan 2018 16:32:24 +0100 Subject: Address bar completer doesn't show up if there's nothing to suggest --- lib/navigation/urllineedit.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/navigation/urllineedit.cpp b/lib/navigation/urllineedit.cpp index 4c207a1..2d2ac40 100644 --- a/lib/navigation/urllineedit.cpp +++ b/lib/navigation/urllineedit.cpp @@ -15,6 +15,7 @@ // ssl menu #include +// completer #include #include @@ -107,15 +108,17 @@ void UrlLineEdit::updateCompleter(const QString &text) } const QModelIndexList res = m_bookmarksModel->match(QModelIndex(), Qt::EditRole, text, 7); + if(res.isEmpty()) { + m_listView->hide(); + return; + } + QStringList l; for(const QModelIndex &idx : res) { l.append(idx.data(Qt::EditRole).toString()); } - if(!text.isEmpty()) { - l.append(text); - } - QStringListModel *m = new QStringListModel(l, this); + auto *m = new QStringListModel(l, this); m_listView->setModel(m); -- cgit v1.2.1