c++ - QFileDialog (QT 5.2.1/mingw32) won't allow me to choose a read-only file -
QT 5.2.1
Win7 64-bit
I use QFileDialog to select I am filename
- It is unknown at the time of choosing that the file will be written or read, so QFileDialog :: getOpenFilename () and QFileDIalog :: getSaveFilename () do not work well for this Are there.
For some reason, I can not choose a file that has been marked "Read Only".
If I pass options for "DontUseNativeDialog" So, I can do select the file to read only, though it is less than ideal. AFACTT, there is no reason that I should not be able to select the read only file with local dialogue. Is it just a bug in the implementation of windows, or am I missing something?
The relevant code for creating dialogs:
// Create a normal file dialog QFileDialog dialog (NULL, Tr ("select disk image")); Dialog.setNameFilter (tr ("Image Files (* .img * .IMG) ;; *. *")); dialog.setFileMode (QFileDialog :: AnyFile); // Basic dialog should be. Setup mode (QFileDialog :: extension); // should be the default dialog .Setax Module (QFileDialog :: AcceptOpen); // Basic dialog should be. Setup (QFileDialog :: DontConfirmOverwrite, true); Caststring File Location = Faucet; If (selected dialog.exec ()) {// selectedFiles gives a QStringList - only one file name is expected, // then use the element of zero from that list file location = (dialog.selectedFiles ()) [0] ; }
The complete test project is pasted here:
This is a bug in Q5.5.2. It is assumed that 5.3 is fixed in alpha.
Comments
Post a Comment