【发布时间】:2025-12-07 02:55:02
【问题描述】:
我想通过输入一个字符串来过滤我的所有数据,听起来很简单。 这是我到目前为止得到的:
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))));
}
如果我只搜索一个单词,或者如果我在单词之间搜索“*”(如果它们以正确的顺序出现),这很好用。 但是如何搜索多个单词并且单词的顺序无关紧要?
【问题讨论】: