[英]Customized QFileDialog
I want to implement customized file open dialog using Qt. 我想使用Qt实现自定义文件打开对话框。 I have following scenario I have file with this kind of extension 我有以下情况,我有带有这种扩展名的文件
a.txt.1
a.txt.2
a.txt.3
b.txt.1
b.txt.2
c.txt.1
c.txt.4
In file Dialog i want to show only file with highest number extension egatxt.3 , b.txt.2 , c.txt.4 is there any way to add filter in QFileDialog. 在文件Dialog中,我只想显示扩展名最大的文件egatxt.3,b.txt.2,c.txt.4,可以在QFileDialog中添加过滤器。 If you have any suggestion besides from filtering please let me know. 如果您除了过滤之外还有其他建议,请告诉我。
You should implement and set your own proxy model: 您应该实现并设置自己的代理模型:
void QFileDialog:: setProxyModel (QAbstractProxyModel * proxyModel) 无效的QFileDialog :: setProxyModel (QAbstractProxyModel * proxyModel)
Sets the model for the views to the given proxyModel. 将视图的模型设置为给定的proxyModel。 This is useful if you want to modify the underlying model; 如果要修改基础模型,这很有用; for example, to add columns, filter data or add drives. 例如,添加列,过滤数据或添加驱动器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.