src/gui/util/qcompleter.cpp
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
child 37 758a864f9613
--- a/src/gui/util/qcompleter.cpp	Tue Jul 06 15:10:48 2010 +0300
+++ b/src/gui/util/qcompleter.cpp	Wed Aug 18 10:37:55 2010 +0300
@@ -154,6 +154,7 @@
 #include "QtGui/qevent.h"
 #include "QtGui/qheaderview.h"
 #include "QtGui/qdesktopwidget.h"
+#include "QtGui/qlineedit.h"
 
 QT_BEGIN_NAMESPACE
 
@@ -920,8 +921,9 @@
 void QCompleterPrivate::_q_fileSystemModelDirectoryLoaded(const QString &path)
 {
     Q_Q(QCompleter);
+    QLineEdit *lineEdit = qobject_cast<QLineEdit *>(widget);
     //the path given by QFileSystemModel does not end with /
-    if (!q->completionPrefix().isEmpty() && q->completionPrefix() != path + QLatin1Char('/'))
+    if (lineEdit && !lineEdit->text().isEmpty() && !q->completionPrefix().isEmpty() && q->completionPrefix() != path + QLatin1Char('/'))
         q->complete();
 }