当前位置:网站首页>Qt——获取文件夹下所有子文件名称
Qt——获取文件夹下所有子文件名称
2022-08-08 16:54:00 【泉伟】
在头文件夹声明
#include <QDebug>
#include<QFileDialog>
主程序
QString filePath;
QDir *dir=new QDir(filePath);
QStringList filter;
QList<QFileInfo> *fileInfo=new QList<QFileInfo>(dir->entryInfoList(filter));
for(int i = 0;i<fileInfo->count(); i++)
{
qDebug()<<fileInfo->at(i).filePath();
qDebug()<<fileInfo->at(i).fileName();
}
在上述程序中将文件夹的路径赋值给filePath,主要路径格式,需要使用“\‘’或者“/”。
例如
C:/Users/1102/Desktop
或者
C:\\Users\\1102\\Desktop
显示结果
"C:/Users/1102/Desktop/."
"C:/Users/1102/Desktop/.."
生成文件结果中会包含后缀为“.‘’与“…”,这两个分别表示为当前目录与上一级目录。
边栏推荐
猜你喜欢

测试/开发程序员停滞不前,倦怠怎么办?突破各种失败和挫折......

数字图像处理(六)—— 图像压缩
![ImportError: numpy.core.multiarray failed to import [cv2, matplotlib, PyTorch, pyinstaller ]](/img/4c/21f6707e771ca7a21e467331b9b8e5.jpg)
ImportError: numpy.core.multiarray failed to import [cv2, matplotlib, PyTorch, pyinstaller ]

【20210923】选择感兴趣的研究方向?

二、pytest+selenium+allure实现web ui自动化

开源项目管理解决方案Leantime

Acwing第 63 场周赛【未完结】
![[Paper Reading] RAL 2022: Receding Moving Object Segmentation in 3D LiDAR Data Using Sparse 4D Convolutions](/img/6c/2d8469b2113f6c23c5b75e6f6e479e.png)
[Paper Reading] RAL 2022: Receding Moving Object Segmentation in 3D LiDAR Data Using Sparse 4D Convolutions

QCon 回顾 | Data Fabric:逻辑统一、物理分散

LeetCode_二叉树_中等_515.在每个树行中找最大值
随机推荐
L2-022 重排链表 (25 分)(模拟链表)
ctfshow七夕杯复现
PNAS最新研究:81%解题率,神经网络 Codex 推开高等数学世界大门
用完华为云会议解决方案,我直接卸载了之前的会议软件【华为云至简致远】
Photoshop2021安装教程
正则什么的,你让我写,我会难受,你让我用,真香!
[机缘参悟-64]:《兵者,诡道也》-5-孙子兵法解读-混战计
【数学模型】TOPSIS
Chapter 20 Source Code File REST API Reference (2)
【论文阅读】RAL 2022: Receding Moving Object Segmentation in 3D LiDAR Data Using Sparse 4D Convolutions
李沐:机器学习者进阶学习建议
【20210923】选择感兴趣的研究方向?
LeetCode_Backtrack_Medium_491. Incrementing Subsequence
L2-017 人以群分 (25 分)
L2-020 功夫传人 (25 分)
函数节流与函数防抖
使用train_test_split划分训练数据集、测试数据集
LeetCode_回溯_中等_491.递增子序列
Acwing Week 63 [Unfinished]
vi编辑器命令