• 5641阅读
  • 4回复

[提问]QDialog中getopenfilename()的filter参数 [复制链接]

上一主题 下一主题
离线cxlbr
 
只看楼主 倒序阅读 楼主  发表于: 2011-09-04
请问各位,getopenfilename函数的参数filter是如何写的,为什么要写成"Images (*.png *.jpg)",我要知道原因?
谢谢!
离线jdwx

只看该作者 1楼 发表于: 2011-09-04
回 楼主(cxlbr) 的帖子
那你说说为什么C++语句 结尾要写一个分号?
其实没什么原因要写分号。
发帖时要说明:操作系统、Qt版本、编译器,这样能更快的得到回复。
离线cxlbr
只看该作者 2楼 发表于: 2011-09-04
有一点不明白,“Images (*.png)”可以,“adfaf (*.png)”也可以,我觉得这个地方应该有规定的
离线dbzhang800

只看该作者 3楼 发表于: 2011-09-04
引用第2楼cxlbr于2011-09-04 13:35发表的  :
有一点不明白,“Images (*.png)”可以,“adfaf (*.png)”也可以,我觉得这个地方应该有规定的

多看看Manual:

If filter contains a pair of parentheses containing one or more of anything*something, separated by spaces, then only the text contained in the parentheses is used as the filter. This means that these calls are all equivalent:
  1. dialog.setNameFilter("All C++ files (*.cpp *.cc *.C *.cxx *.c++)");
  2. dialog.setNameFilter("*.cpp *.cc *.C *.cxx *.c++");


离线cxlbr
只看该作者 4楼 发表于: 2011-09-04
回 3楼(dbzhang800) 的帖子
谢谢!
快速回复
限100 字节
 
上一个 下一个