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