1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

Proper fix for previous commit

d42b50cc15 Empty locationbar upon writing first char
This commit is contained in:
nowrep 2012-12-08 18:12:31 +01:00
parent d42b50cc15
commit 4e114b69c5
2 changed files with 5 additions and 1 deletions

View File

@ -27,6 +27,7 @@ LocationCompleterModel* LocationCompleter::s_model = 0;
LocationCompleter::LocationCompleter(QObject* parent) LocationCompleter::LocationCompleter(QObject* parent)
: QObject(parent) : QObject(parent)
, m_locationBar(0) , m_locationBar(0)
, m_ignoreCurrentChangedSignal(false)
{ {
if (!s_view) { if (!s_view) {
s_model = new LocationCompleterModel; s_model = new LocationCompleterModel;
@ -63,7 +64,8 @@ void LocationCompleter::showMostVisited()
void LocationCompleter::currentChanged(const QModelIndex &index) void LocationCompleter::currentChanged(const QModelIndex &index)
{ {
if (!index.isValid()) { if (m_ignoreCurrentChangedSignal) {
m_ignoreCurrentChangedSignal = false;
return; return;
} }
@ -120,6 +122,7 @@ void LocationCompleter::adjustPopupSize()
popupHeight += 2 * s_view->frameWidth(); popupHeight += 2 * s_view->frameWidth();
s_view->resize(s_view->width(), popupHeight); s_view->resize(s_view->width(), popupHeight);
m_ignoreCurrentChangedSignal = true;
s_view->setCurrentIndex(QModelIndex()); s_view->setCurrentIndex(QModelIndex());
s_view->show(); s_view->show();

View File

@ -55,6 +55,7 @@ private:
LocationBar* m_locationBar; LocationBar* m_locationBar;
QString m_originalText; QString m_originalText;
bool m_ignoreCurrentChangedSignal;
static LocationCompleterView* s_view; static LocationCompleterView* s_view;
static LocationCompleterModel* s_model; static LocationCompleterModel* s_model;