Reputation: 39
I want to open a file explorer which will be independent from the application, and will act exactly like if the user opens a file explorer from Desktop. I do not need QFileDialog since I do not need to know what file will the user choose.
Upvotes: 1
Views: 2461
Reputation: 1221
You should use the desktop services, it will open the available application to handle the url you pass to it. The following opens a file browser in the root directory.
#include <QDesktopServices>
#include <QUrl>
QDesktopServices::openUrl(QUrl("file:///"));
Upvotes: 4
Reputation: 1293
Try QProcess
#include <QProcess>
int main(int argc, char *argv[])
{
QProcess::startDetached("C:\\Windows\\explorer.exe", {});
return 0;
}
Upvotes: 2