Я бы хотел настроить QCompleter, чтобы он поддерживал поиск по подстановочным знакам и регулярным выражениям. Однако, когда я использую setFilterMode(Qt.MatchRegExp)
, появляется предупреждение: Unhandled QCompleter::filterMode flag is used.
Когда я смотрю на исходный код Qt, это
/*!
\property QCompleter::filterMode
\brief how the filtering is performed
\since 5.2
If filterMode is set to Qt::MatchStartsWith, only those entries that start
with the typed characters will be displayed. Qt::MatchContains will display
the entries that contain the typed characters, and Qt::MatchEndsWith the
ones that end with the typed characters.
Currently, only these three modes are implemented. Setting filterMode to
any other Qt::MatchFlag will issue a warning, and no action will be
performed.
The default mode is Qt::MatchStartsWith.
*/
void QCompleter::setFilterMode(Qt::MatchFlags filterMode)
{
Q_D(QCompleter);
if (d->filterMode == filterMode)
return;
if (Q_UNLIKELY(filterMode != Qt::MatchStartsWith &&
filterMode != Qt::MatchContains &&
filterMode != Qt::MatchEndsWith)) {
qWarning("Unhandled QCompleter::filterMode flag is used.");
return;
}
d->filterMode = filterMode;
d->proxy->createEngine();
d->proxy->invalidate();
}
Так как мне настроить мой QCompleter? Заранее спасибо.