From 4e114b69c5ca0a7aef8eaf290af274064fdd3bc8 Mon Sep 17 00:00:00 2001 From: nowrep Date: Sat, 8 Dec 2012 18:12:31 +0100 Subject: [PATCH] Proper fix for previous commit d42b50cc15 Empty locationbar upon writing first char --- src/lib/navigation/completer/locationcompleter.cpp | 5 ++++- src/lib/navigation/completer/locationcompleter.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/navigation/completer/locationcompleter.cpp b/src/lib/navigation/completer/locationcompleter.cpp index 37170b99a..bbf74cfe2 100644 --- a/src/lib/navigation/completer/locationcompleter.cpp +++ b/src/lib/navigation/completer/locationcompleter.cpp @@ -27,6 +27,7 @@ LocationCompleterModel* LocationCompleter::s_model = 0; LocationCompleter::LocationCompleter(QObject* parent) : QObject(parent) , m_locationBar(0) + , m_ignoreCurrentChangedSignal(false) { if (!s_view) { s_model = new LocationCompleterModel; @@ -63,7 +64,8 @@ void LocationCompleter::showMostVisited() void LocationCompleter::currentChanged(const QModelIndex &index) { - if (!index.isValid()) { + if (m_ignoreCurrentChangedSignal) { + m_ignoreCurrentChangedSignal = false; return; } @@ -120,6 +122,7 @@ void LocationCompleter::adjustPopupSize() popupHeight += 2 * s_view->frameWidth(); s_view->resize(s_view->width(), popupHeight); + m_ignoreCurrentChangedSignal = true; s_view->setCurrentIndex(QModelIndex()); s_view->show(); diff --git a/src/lib/navigation/completer/locationcompleter.h b/src/lib/navigation/completer/locationcompleter.h index 635d7ad65..1c54fd2ff 100644 --- a/src/lib/navigation/completer/locationcompleter.h +++ b/src/lib/navigation/completer/locationcompleter.h @@ -55,6 +55,7 @@ private: LocationBar* m_locationBar; QString m_originalText; + bool m_ignoreCurrentChangedSignal; static LocationCompleterView* s_view; static LocationCompleterModel* s_model;