Question

I'm requesting the user to select a folder with QFileDialog:

QString directory = QFileDialog::getExistingDirectory(this,"Caption","",
                    QFileDialog::ShowDirsOnly);

I want the user to be able to select ALL folders, however C:/Windows/System32/spool/ cannot be found with the QFileDialog and i suspect there might be others.

I have tried setting the flag QFileDialog::HideNameFilterDetails in order to view hidden files, however this does not do the trick.

Is there a solution to this problem?

C:/Windows/System 32/spool does not exist in QFileDialog

enter image description here

Was it helpful?

Solution

This appears to be a problem when you're running a 32-bit application on 64-bit Windows. You should be able to see the spool folder if you compile your application with the native x64 compiler. Worst case, you can write a simple 64-bit native app for showing the folder browser and have the 32-bit app run and communicate with the 64-bit app to get the results.

I was hoping that disabling the WOW64 File System Redirector would be enough, but it didn't help. According to this answer, it may work if you use Wow64DisableWow64FsRedirection to disable redirection on all the threads in the process but this approach is not recommended even by the person who answered the question.

OTHER TIPS

You can't use that static function to see all folders. QFileDialog is doing some additional filtering behind the scenes, and that this filtering cannot be turned off in any obvious way using static function getExistingDirectory.

You can see all folders including the hidden ones by:

QFileDialog fd;
fd.setFilter(QDir::Hidden);
fd.setFileMode(QFileDialog::Directory);
fd.exec();
QString directory = fd.directory().path();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top