QT——文件对话框QFileDialog
来源:互联网 发布:淘宝主图制作教程 编辑:程序博客网 时间:2024/05/18 03:59
QStringListQFileDialog::getOpenFileNames(QWidget* parent = 0, constQString& caption = QString(), constQString& dir = QString(), constQString & filter = QString(),QString* selectedFilter = 0,Options options = 0) [static]
这是一个便利的静态类,(以“路径+文件名”的方式)返回一个或多个被用户选择的文件。
--------------------------------------------------------------------------------------------QStringList files = QFileDialog::getOpenFileNames(
this,
"Select one or more files to open",
"/home",
"Images (*.png *.xpm *.jpg)");
该函数在跟定的 parent widget 上创建一个模式文件对话框。如果 parent 参数不为 0,对话框将被显示在 parent widget 的中间。
--------------------------------------------------------------------------------------------该文件对话框的工作目录被设定到 dir 上。如果dir 包含文件名,则这个文件将被选择。The filter is set to filter so that only those files which match the filter are shown. The filter selected is set to selectedFilter. The parametersdir, selectedFilter and filter may be empty strings. 如果需要多重过滤,用';;'将它们分开。例如:
The dialog's caption is set to caption. If caption is not specified then a default caption will be used.
--------------------------------------------------------------------------------------------
On Windows, and Mac OS X, this static function will use the native file dialog(使用本地对话框) and not a QFileDialog.
Note: 如果想要迭代文件列表,你应该遍历的是一个副本。For example:
QStringListlist = files; //QStringList Inherits:QList<QString>QStringList::Iterator it = list.begin();
while(it != list.end()) {
myProcessing(*it);
++it;
}
或者用下面的方式进行遍历:
for(int i=0; i<files.size(); ++i) {
QString path=QDir::toNativeSeparators(files.at(i));
if(!path.isEmpty()) {
;
}
}
note:QString QDir::toNativeSeparators(const QString & pathName) [static]
/* Returns pathName with the '/' separators converted to separators that are appropriate for the underlying operating system.*/
- QT——文件对话框QFileDialog
- Qt中 文件对话框QFileDialog 的使用
- Qt中 文件对话框QFileDialog 的使用
- Qt中 文件对话框QFileDialog 的使用
- Qt QFileDialog实现文件选择对话框
- qt——QFileDialog使用对话框选取本地文件
- Qt 之路 (15)—标准对话框之QFileDialog
- Qt文件操作之——QFileDialog保存文件
- 文件对话框(QFileDialog)
- Qt标准对话框之QFileDialog
- Qt标准对话框之QFileDialog
- Qt标准对话框之QFileDialog
- Qt标准对话框之QFileDialog
- PtQt4标准对话框——QFileDialog
- 文件对话框QFileDialog 的使用
- PyQt5:QFileDialog文件对话框(22)
- PyQt5打开文件对话框QFileDialog
- Qt学习之十二:标准对话框之二QFileDialog文件对话框
- JQuery 限制文本框只能输入数字和小数点
- [Oracle] - 性能优化工具(2) - ASH
- 软工文档--机房收费系统文档总结
- oracle 将视图权限授予普通用户
- 刨根问底:C++中未初始化全局变量为什么都会被编译器自动置0
- QT——文件对话框QFileDialog
- C语言字符串替换函数
- 快速解决linux上oracle安装乱码问题
- 如何在Java中进行字符串(String)比较
- C++中的mutable关键字
- python编码问题。
- Ejb in action(七)——message与JMS
- static成员变量和成员函数可以被继承
- 安装Adobe air时出错:管理员可能不允许安装此软件问题解决办法(Windows8)