我想为我的文件浏览器应用程序实现搜索选项。 我可以在接受用户的输入后获得该项目。现在,我想将这个项目添加到我的列表视图。在搜索结束后,该项目应该可以点击打开它们。如何使用Qt添加找到的项目到QListView?
这里是一段代码...任何建议将不胜感激。
void Browser::search()
{
QDirIterator it(path,QDir::AllDirs|QDir::Files|QDir::NoSymLinks|QDir::NoDotAndDotDot,QDirIterator::Subdirectories);
while(it.hasNext())
{
it.next();
if(it.fileInfo().completeBaseName().contains(content,Qt::CaseInsensitive))
{
qDebug()<<"it.fileinfo = "<<it.fileInfo().fileName();
}
}
path.clear();
}
不要忘记关闭这个问题:) – Seba 2011-03-18 13:23:46