QFileDialog如何选择多个文件

来源:互联网 发布:有声相册制作软件 编辑:程序博客网 时间:2024/06/04 19:14

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


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

 

    add_file_dialog->setFileMode(QFileDialog::ExistingFiles);  


  

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


    add_file_dialog->setFileMode(QFileDialog::ExistingFile); 


enum QFileDialog::FileModeThis 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.ConstantValueDescriptionQFileDialog::AnyFile0The name of a file, whether it exists or not.QFileDialog::ExistingFile1The name of a single existing file.QFileDialog::Directory2The name of a directory. Both files and directories are displayed.QFileDialog::ExistingFiles3The names of zero or more existing files.



email: tongzhuodenilove@163.com

author:wsh

0 0