aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-01-08 16:32:24 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2018-01-08 16:32:24 +0100
commit60f46cd8b154a2ad584d072481ff00d6fa23b2f1 (patch)
treed1f5fe827134e63a364131a4da84a959089dfd6c
parentFixed bugs with QDockWidgets (diff)
downloadsmolbote-60f46cd8b154a2ad584d072481ff00d6fa23b2f1.tar.xz
Address bar completer doesn't show up if there's nothing to suggest
-rw-r--r--lib/navigation/urllineedit.cpp11
-rw-r--r--src/mainwindow.h4
2 files changed, 8 insertions, 7 deletions
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 <QLabel>
+// completer
#include <QListView>
#include <QStringListModel>
@@ -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);
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 8febb71..c83778e 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -9,14 +9,12 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
+#include "lib/navigation/navigationbutton.h"
#include "webengine/webengineprofile.h"
#include "widgets/loadingbar.h"
#include "widgets/mainwindowtabbar.h"
#include <QMainWindow>
#include <QUrl>
-
-#include "lib/navigation/navigationbutton.h"
-
#include <memory>
namespace Ui