qt
CleMints
Attachment to Code
展开
-
QT:QDomDocument读取解析XML内容
今天在做模拟仿真项目时,需要读取并解析XML文件,读取仿真配置参数,一般来说解析配置参数或者需要经常读存的地方就需要用到解析XML文件。下面给一段小demo来解析XML文件:void ReadXML(){ QDomDocument doc; QFile file(".../×××.xml"); if(!file.open(QIODevice::ReadOnly)) return 0; if(!doc.setContent(&file)) { file.close(); re原创 2021-10-30 17:18:44 · 1361 阅读 · 0 评论 -
QT筛选指定路径文件路径以及文件名
//筛选指定目录下文件路径QString path= QApplication::applicationDirPath() + "/temp";QDirIterator it(path,QStringList() << "*.txt"<<"*.png",QDir::Files);while(it.hasNext()){ QString str = it.next(); qDebug()<<"filePath:"<<str<<原创 2021-10-27 15:35:29 · 1073 阅读 · 0 评论