QT 创建文件夹 bool QDir::mkdir ( const QString & dirName ) const
创建一个子目录名为目录名。[喝小酒的网摘]http://blog.hehehehehe.cn/a/4531.htm
如果成功则返回TRUE,否则返回false。
bool QDir::mkpath ( const QString & dirPath ) const
创建该目录路径dirPath。
该函数将创建所有的父目录中的各个子目录。
如果成功,则返回true,否则返回false。
QT 选择一个文件
QString QFileDialog::getOpenFileName ( QWidget * parent = 0, const QString & caption = QString(), const QString & dir = QString(), const QString & filter = QString(), QString * selectedFilter = 0, Options options = 0 ) [static]
这是一个方便的静态函数,返回一个现有文件由用户选择。如果用户按下取消,则返回一个空字符串。
示例:
QT 选择文件夹
QString QFileDialog::getExistingDirectory ( QWidget * parent = 0, const QString & caption = QString(), const QString & dir = QString(), Options options = ShowDirsOnly ) [static]
这个函数创建一个具有给定父窗口部件模态文件对话框。如果父母不为0,对话框将显示在父控件为中心。
该对话框的工作目录设置为目录,并设置标题为标题。上述两种可能是一个空字符串,这种情况下,当前目录和默认标题将分别采用。
options参数包括有关如何运行对话框中,看到QFileDialog各种选项::有关的标志可以传递信息选项枚举。为确保本地文件对话框,ShowDirsOnly必须设置。
在Windows和Mac OS X中,这个静态函数将使用本地文件对话框,而不是QFileDialog。
示例:
QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), "/home", QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
来源:http://blog.hehehehehe.cn/a/4531.htm
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:- Scala在资源文件夹中获取文件的文件路径
- Node.js折腾记一:读指定文件夹,输出该文件夹的文件树
- C/C++遍历文件夹和文件
- 如何使用Python删除一个文件或文件夹
- tar打包如何不打包某一个文件夹(排除某些文件夹)
- 如何解密Windows 10中的EFS加密文件和文件夹
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Developer's Guide to Social Programming
Mark D. Hawker / Addison-Wesley Professional / 2010-8-25 / USD 39.99
In The Developer's Guide to Social Programming, Mark Hawker shows developers how to build applications that integrate with the major social networking sites. Unlike competitive books that focus on a s......一起来看看 《Developer's Guide to Social Programming》 这本书的介绍吧!