QFileDialog如何选择多个文件

   QFileDialog 按说是默认选择多个文件,但是我的ctrl 和shift键都不管用,每次只能选择一个文件,很惆怅....


   网上大部分都是问如何选择多个文件和文件夹的.后来发现:

 

    add_file_dialog->setFileMode(QFileDialog::ExistingFiles);  


  

  是设置选择多个文件的,  请注意和以下语句的区别


    add_file_dialog->setFileMode(QFileDialog::ExistingFile); 


enum QFileDialog::FileMode
This enum is used to indicate what the user may select in the file dialog; i.e. what the dialog will return if the user clicks OK.

Constant	Value	Description
QFileDialog::AnyFile	0	The name of a file, whether it exists or not.
QFileDialog::ExistingFile	1	The name of a single existing file.
QFileDialog::Directory	2	The name of a directory. Both files and directories are displayed.
QFileDialog::ExistingFiles	3	The names of zero or more existing files.



email: tongzhuodenilove@163.com

author:wsh

  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值