logplus/Workflow/WFCrystal/Crystal/src/SmartCompleter.cpp
2026-01-16 17:18:41 +08:00

26 lines
593 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @file SmartCompleter.cpp
* @brief PAI系统定制Completer类实现包含匹配
* @date 2015-04-30
*/
#include "SmartCompleter.h"
using namespace pai;
SmartCompleter::SmartCompleter(QStringListModel *pModel, QObject * pParent)
:QCompleter(pParent)
, m_pBaseModel(pModel)
, m_model()
{
setModel(&m_model);
}
void SmartCompleter::Update(const QString& word)
{
// Do any filtering you like.
// Here we just include all items that contain word.
QStringList filtered = m_pBaseModel->stringList().filter(word, caseSensitivity());
m_model.setStringList(filtered);
complete();
}