src/gui/util/qcompleter.cpp
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
child 37 758a864f9613
equal deleted inserted replaced
30:5dc02b23752f 33:3e2da88830cd
   152 #include "QtGui/qlistview.h"
   152 #include "QtGui/qlistview.h"
   153 #include "QtGui/qapplication.h"
   153 #include "QtGui/qapplication.h"
   154 #include "QtGui/qevent.h"
   154 #include "QtGui/qevent.h"
   155 #include "QtGui/qheaderview.h"
   155 #include "QtGui/qheaderview.h"
   156 #include "QtGui/qdesktopwidget.h"
   156 #include "QtGui/qdesktopwidget.h"
       
   157 #include "QtGui/qlineedit.h"
   157 
   158 
   158 QT_BEGIN_NAMESPACE
   159 QT_BEGIN_NAMESPACE
   159 
   160 
   160 QCompletionModel::QCompletionModel(QCompleterPrivate *c, QObject *parent)
   161 QCompletionModel::QCompletionModel(QCompleterPrivate *c, QObject *parent)
   161     : QAbstractProxyModel(*new QCompletionModelPrivate, parent),
   162     : QAbstractProxyModel(*new QCompletionModelPrivate, parent),
   918 }
   919 }
   919 
   920 
   920 void QCompleterPrivate::_q_fileSystemModelDirectoryLoaded(const QString &path)
   921 void QCompleterPrivate::_q_fileSystemModelDirectoryLoaded(const QString &path)
   921 {
   922 {
   922     Q_Q(QCompleter);
   923     Q_Q(QCompleter);
       
   924     QLineEdit *lineEdit = qobject_cast<QLineEdit *>(widget);
   923     //the path given by QFileSystemModel does not end with /
   925     //the path given by QFileSystemModel does not end with /
   924     if (!q->completionPrefix().isEmpty() && q->completionPrefix() != path + QLatin1Char('/'))
   926     if (lineEdit && !lineEdit->text().isEmpty() && !q->completionPrefix().isEmpty() && q->completionPrefix() != path + QLatin1Char('/'))
   925         q->complete();
   927         q->complete();
   926 }
   928 }
   927 
   929 
   928 /*!
   930 /*!
   929     Constructs a completer object with the given \a parent.
   931     Constructs a completer object with the given \a parent.