diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-10-14 21:18:16 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-10-14 21:18:16 (GMT) |
commit | 817e6fef7c538a87cfc62b6f02d14b3e5aa39468 (patch) | |
tree | 7e48a8c60513a32139d87ce2c14e8667e0c5bdff /src/gui/util | |
parent | 9358d77fc1de64d2a8a06bfa4095dcde9f9b009b (diff) | |
parent | 830df741afc987f12d744bfab8a4b9ee538c212a (diff) | |
download | Qt-817e6fef7c538a87cfc62b6f02d14b3e5aa39468.zip Qt-817e6fef7c538a87cfc62b6f02d14b3e5aa39468.tar.gz Qt-817e6fef7c538a87cfc62b6f02d14b3e5aa39468.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: (61 commits)
tst_qcompleter: Fix the QTBUG_14292_filesystem test on X11
tst_qcompleter.cpp: fix test on mac.
Fixed autotest that was missing focus on Windows
QGraphicsLayoutItem - user set sizes should always override, even if there's a constraint
QGridLayoutEngine - Rework height-for-width support so that row/col spanning works
Revert "Revert "Fix (implement!) hfw/wfh in QGridLayoutEngine""
Fixed statement about const_iterator and some whitespace fixes.
Adjust the parent index for the itemsMoved call.
Correctly handle both 16bit and 32bit live pixmaps in meego graphics system.
Correctly remove the egl alpha surface flags in meego graphics system.
Proper dither & proper alpha checking.
In meego graphics system, use always 16bit textures.
QCompleter: do not auto complete when directory is changed.
tst_qcompleter: Add a test for QFileSystemModel
Doc: adjusting the search field width
Doc - remove disclaimer
Added the default format of QTime::toString().
Moved the property documentation to its proper location.
Added Q_INVOKABLE to ignore file.
Made several QMenuBar functions visible to qdoc and added documentation.
...
Diffstat (limited to 'src/gui/util')
-rw-r--r-- | src/gui/util/qcompleter.cpp | 18 | ||||
-rw-r--r-- | src/gui/util/qcompleter_p.h | 1 |
2 files changed, 13 insertions, 6 deletions
diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp index e718212..bcd601b 100644 --- a/src/gui/util/qcompleter.cpp +++ b/src/gui/util/qcompleter.cpp @@ -782,7 +782,8 @@ QMatchData QUnsortedModelEngine::filter(const QString& part, const QModelIndex& /////////////////////////////////////////////////////////////////////////////// QCompleterPrivate::QCompleterPrivate() : widget(0), proxy(0), popup(0), cs(Qt::CaseSensitive), role(Qt::EditRole), column(0), - maxVisibleItems(7), sorting(QCompleter::UnsortedModel), wrap(true), eatFocusOut(true) + maxVisibleItems(7), sorting(QCompleter::UnsortedModel), wrap(true), eatFocusOut(true), + hiddenBecauseNoMatch(false) { } @@ -921,12 +922,14 @@ void QCompleterPrivate::showPopup(const QRect& rect) void QCompleterPrivate::_q_fileSystemModelDirectoryLoaded(const QString &path) { Q_Q(QCompleter); -#ifndef QT_NO_LINEEDIT - QLineEdit *lineEdit = qobject_cast<QLineEdit *>(widget); - //the path given by QFileSystemModel does not end with / - if (lineEdit && !lineEdit->text().isEmpty() && !q->completionPrefix().isEmpty() && q->completionPrefix() != path + QLatin1Char('/')) + // Slot called when QFileSystemModel has finished loading. + // If we hide the popup because there was no match because the model was not loaded yet, + // we re-start the completion when we get the results + if (hiddenBecauseNoMatch + && prefix.startsWith(path) && prefix != (path + '/') + && widget) { q->complete(); -#endif + } } /*! @@ -1200,6 +1203,7 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e) Q_D(QCompleter); if (d->eatFocusOut && o == d->widget && e->type() == QEvent::FocusOut) { + d->hiddenBecauseNoMatch = false; if (d->popup && d->popup->isVisible()) return true; } @@ -1378,6 +1382,7 @@ void QCompleter::complete(const QRect& rect) { Q_D(QCompleter); QModelIndex idx = d->proxy->currentIndex(false); + d->hiddenBecauseNoMatch = false; if (d->mode == QCompleter::InlineCompletion) { if (idx.isValid()) d->_q_complete(idx, true); @@ -1389,6 +1394,7 @@ void QCompleter::complete(const QRect& rect) || (d->mode == QCompleter::UnfilteredPopupCompletion && d->proxy->rowCount() == 0)) { if (d->popup) d->popup->hide(); // no suggestion, hide + d->hiddenBecauseNoMatch = true; return; } diff --git a/src/gui/util/qcompleter_p.h b/src/gui/util/qcompleter_p.h index 8f00793..19b76e5 100644 --- a/src/gui/util/qcompleter_p.h +++ b/src/gui/util/qcompleter_p.h @@ -93,6 +93,7 @@ public: bool eatFocusOut; QRect popupRect; + bool hiddenBecauseNoMatch; void showPopup(const QRect&); void _q_complete(QModelIndex, bool = false); |