QFileDialog :: getExistingDirectory in the explorer does not display the directories of connected devices
-
I have a phone connected and it is displayed in Explorer:
But when I try to open the explorer using the code in the program:void IdentifyDevice::Explorer() { QString path = QFileDialog::getExistingDirectory(this, tr("Открыть каталог"), "/home", QFileDialog::DontResolveSymlinks); DevicePathLineEdit->setText(path); }
Apple iPhone devices not in "Devices and drives." How to display all devices that are connected in "Devices and drives"?
-
This is not supported since this location does not return a valid file path I would guess (the call to SHBrowseForFolder explicitly states that Qt needs a valid url: https://code.woboq.org/qt5/qtbase/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp.html#1816 and https://docs.microsoft.com/de-de/windows/win32/api/shlobj_core/ns-shlobj_core-browseinfoa / BIF_RETURNONLYFSDIRS )
-
@Christian-Ehrlicher Is there any way to do this? I need to identify the device in the program and specify the path to the device
-
@haifisch said in QFileDialog :: getExistingDirectory in the explorer does not display the directories of connected devices:
Is there any way to do this?
Not with Qt. But as you can see in the calling the WinAPI isn't that hard.
-
@Christian-Ehrlicher thanks I will try
-
@Christian-Ehrlicher I do not understand which library I need to connect for
BROWSEINFO bi;
-
@haifisch said in QFileDialog :: getExistingDirectory in the explorer does not display the directories of connected devices:
which library I need to connect for
See the documentation link I gave you, at the bottom.