#include <completer.h>
|
enum | ModelFiltering { FilterStartsWith =0
, FilterContains
, FilterWordStartsWith
} |
|
|
| Completer (QObject *parent=0) |
|
| Completer (QAbstractItemModel *model, QObject *parent=0) |
|
| Completer (const QStringList &list, QObject *parent=0) |
|
ModelFiltering | modelFiltering () const |
|
void | setModelFiltering (ModelFiltering filter) |
|
virtual QStringList | splitPath (const QString &s) const |
|
QAbstractItemModel * | sourceModel () const |
|
void | setSourceModel (QAbstractItemModel *model) |
|
Completer is a QCompleter that allows different way of filtering the model, not just by filtering strings that start with the
- See also
- completionPrefix (default behavior). Completer is a bit hackish as it reimplements a methods (splitPath) from QCompleter in a way that is not intended. Disclaimer, it might not work in all contexts, but seems to work fine with a QLineEdit. e.g.: QStringList model; model << "toto tata tutu"; model << "tata toto tutu"; Completer completer(model); completer.setModelFiltering(Completer::FilterWordStartsWith); QLineEdit lineEdit; lineEdit.setCompleter(&completer); ... If the user types "ta", both entries will show up in the completer If the user types "ot", no entries will show up in the completer however using
-
FilterContains would have shown both.
◆ sourceModel()
QAbstractItemModel * Completer::sourceModel |
( |
| ) |
const |
Completer::model() might return a filtered model (QSortFilterAbstractModel) different from the one that was set. QCompleter::setModel should not be used and setSourceModel used instead.
◆ modelFiltering
ModelFiltering Completer::modelFiltering |
|
readwrite |
FilterStartsWith is the default behavior (same as QCompleter).The completer filters out strings that don't start with
- See also
- completionPrefix FilterContains is the most permissive filter, the completer filters out only strings that don't contain the characters from
-
completionPrefix FilterWordStartsWith is useful when strings contain space separated words and
-
completionPrefix applies to the beginning of any of the words in the string.
The documentation for this class was generated from the following files:
- C:/Workspace/itom_development_VS2019_Qt5.15.2_x64/itomProject/itom/itomWidgets/helper/completer.h
- C:/Workspace/itom_development_VS2019_Qt5.15.2_x64/itomProject/itom/itomWidgets/helper/completer.cpp