当前位置:网站首页>Qt——选择文件夹并获取路径以及文件夹下子文件
Qt——选择文件夹并获取路径以及文件夹下子文件
2022-08-08 16:54:00 【泉伟】
这个实现比较简单,就是借助Qt中QFileDialog库的getExistingDirectory()函数,可以直接返回当前文件夹的路径。
头文件声明
#include<QFileDialog>
主程序
QString filename = QFileDialog::getExistingDirectory();
获取文件夹下子文件名称
头文件声明
#include <QDebug>
#include<QFileDialog>
主程序
QString filename = QFileDialog::getExistingDirectory();
QDir *dir=new QDir(filename);
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();
}
边栏推荐
- 数字图像处理(六)—— 图像压缩
- ESP8266-Arduino编程实例-ADXL345三轴加速计驱动
- GHOST tool to access the database
- 六、Jmeter定时器
- L2-025 分而治之 (25 分)
- 看到这个应用上下线方式,不禁感叹:优雅,太优雅了!
- 函数节流与函数防抖
- JVM内存Dump原理与在线分析实战
- Obtain - 64 [chances] : the soldier, subtlety also - 5 - read sun tzu - melee meter
- ggplot2可视化水平箱图并使用fct_reorder排序数据、使用na.rm处理缺失值(reorder boxplot with fct_reorder)、按照箱图的中位数从大到小排序水平箱图
猜你喜欢
随机推荐
永续合约交易所系统开发逻辑详情
暴力解决MySQL出现的莫名其妙的问题-重启服务!
Using PyGame's Bubble Sort Visualizer
L2-024 部落 (25 分)(并查集)
国内部分手机游戏开始显示用户IP属地
题目:有序队列
最稳定的淘宝商品详情接口
【LeetCode】试题总结:深度优先搜索 (DFS)
JVM-简介&垃圾回收&内存泄漏分析
第二十章 源代码文件 REST API 参考(二)
MySQL database
leetcode 155. Min Stack最小栈(中等)
【 8.7 】 source code - card to LCM with GCD 】 【 】
字节一面:TCP 和 UDP 可以使用同一个端口吗?
函数节流与函数防抖
看到这个应用上下线方式,不禁感叹:优雅,太优雅了!
L2-028 秀恩爱分得快 (25 分)
APICloud AVM wraps date and time selection components
Patience sorting - specializing in quickly solving the longest increasing subarray
phar反序列化