当前位置:网站首页>手机连接电脑后,QT的QDIR怎么读取手机文件路径
手机连接电脑后,QT的QDIR怎么读取手机文件路径
2022-04-23 03:08:00 【Intimes】
大家都知道Qt的QFileSystemModel类可以建立硬盘上的文件资源模型,从而实现简单的文件管理和文件夹管理,那么手机中的文件该怎么获取呢?这里做i用个小测试:
话不多说 直接上代码:
QString filedir = QCoreApplication::applicationDirPath();
QString filename = QFileDialog::getOpenFileName(
this,
"请选择要打开的video.m4s文件",
filedir,
"m4s (video.m4s)");
// 取消打开则返回
if(filename==QString(""))
return;
// 写入文件路径
ui->lineEdit->setText(filename);
在槽函数中直接敲如上述代码,就可以实现打开文件对话框,寻找文件。通常我们是才自己电脑查找文件,比如:
这时候,我把我心爱的小手机用USB连接电脑,打开文件操作权限,试一下,哎可以看手机文件了
这就是Android手机的内部文件了。好,这时候,我们继续测试我们的代码,把目录切换到手机目录下,并找到想打开的B站文件,比如:
这个文件通常在android/data/tv.danmuku.bili/download/xxxxxxx/c_xxxxxxx/xx/下面。大家注意看上图的路径。这时候打开,结果文件路径就会变成这样:
看看,是不是发生了改变,我贴出这个路径是:
C:/Users/Jo/AppData/Local/Microsoft/Windows/Temporary Internet Files/Content.IE5/NY2XOM6A/video[1].m4s
C:/Users/Jo/AppData/Local/Microsoft/Windows/Temporary Internet Files/Content.IE5/4I7OJ28R/audio[1].m4s
也就是说,手机文件其实是存在临时文件中的。我们用资源管理器找到这个路径,注意这个路径是隐藏的,需要在设置中把隐藏系统文件取消勾选才能找到。这个路径也可用浏览器打开,就类似于FTP服务器那样:
你会发现,里面文件真的是很乱,也不是你手机中的文件,就全都是临时文件。你刚才找到的手机文件,也会在临时文件中。
所以说,想用QT实现文件系统模型,还是任重道远啊!
尽管如此,还是实现了读取手机文件,这就是个进步了。
版权声明
本文为[Intimes]所创,转载请带上原文链接,感谢
https://blog.csdn.net/zjjsd195/article/details/124262191
边栏推荐
- [Euler plan question 13] sum of large numbers
- Laravel8- use JWT
- Two methods are used to solve the "maximum palindrome product" problem
- HLS / chisel practice CORDIC high performance computing complex square root
- svg标签中利用<polygon/>循环数组绘制多边形
- C#中切片语法糖的使用
- Tencent video price rise: earn more than 7.4 billion a year! Pay attention to me to receive Tencent VIP members, and the weekly card is as low as 7 yuan
- Binary tree
- 中后二叉建树
- Distributed system services
猜你喜欢
Detailed log display of openfeign call
編碼電機PID調試(速度環|比特置環|跟隨)
Source generator actual combat
Tencent video price rise: earn more than 7.4 billion a year! Pay attention to me to receive Tencent VIP members, and the weekly card is as low as 7 yuan
TP5 customization in extend directory succeeded and failed. Return information
2022年度Top9的任务管理系统
Laravel new route file
C# WPF UI框架MahApps切换主题
Development notes of raspberry pie (12): start Advantech industrial control raspberry pie uno-220 Kit (I): introduction and operation of the system
MySQL port is occupied when building xampp
随机推荐
MYSQL05_ Ordr by sorting, limit grouping, group by grouping
Systemctl start Prometheus + grafana environment
Notes sur le développement de la tarte aux framboises (XII): commencer à étudier la suite UNO - 220 de la tarte aux framboises de contrôle industriel advantech (i): Introduction et fonctionnement du s
How to count the number of all files in a directory under win10 system
Thoughts on the 2022 national network security competition of the national secondary vocational group (only one idea for myself) - network security competition questions (10)
Recursion - outputs continuously increasing numbers
Blazor University (12)组件 — 组件生命周期
How does Microsoft solve the problem of multiple PC programs
7-11 重排链表 (25 分)
先中二叉建树
Laravel new route file
Assembly learning Chapter III of assembly language (Third Edition) written by Wang Shuang
C# 11 对 ref 和 struct 的改进
First in the binary tree
最通俗易懂的依赖注入与控制反转
微软是如何解决 PC 端程序多开问题的——内部实现
Summary of interface automation interview questions for software testing
C language to achieve address book - (static version)
Fight leetcode again (290. Word law)
Find the number of leaf nodes of binary tree