0
我想通過鍵入一個字符串來過濾所有數據,聽起來很簡單。 這是我走到這一步:Qt - 拆分並使用lineEdit中的字符串作爲regExp
stringToSearch.replace(QRegExp(" "), "|");
QRegExp regExp(stringToSearch,Qt::CaseInsensitive, QRegExp::Wildcard);
model->removeRows(0,model->rowCount());
for(int row = 0; row < stringsInTable.filter(regExp).count(); row++)
{
model->appendRow(new QStandardItem(QString(stringsInTable.filter(regExp).at(row))));
}
這工作得很好,如果我只是尋找一個字或如果我搜索「*」字之間,如果他們在正確的順序是。 但我怎樣才能搜索多個單詞和單詞的順序應該不重要?