Qt 6.11 is out! See what's new in the release
blog
Opening a file using operating system default program for the file type
General and Desktop
3
Posts
2
Posters
1.2k
Views
1
Watching
-
Hi,
I have a number of file names attached to an entry in a database. I simply want the user to be able to open the file in the default program.
Something like this:
@QFancyClass()->openFileUsingDefaultMimeHandler(myfilename).@I've had a look at QProcess, QFile and QDir, but I'm still not sure how to do this. I've most likely missed something; I'd appreciate any pointers!
Thanks in advance.
Edit: I have no need to communicate with the spawned process or anything, I just want to launch it.
-
Use QDesktopServices:
@
QDesktopServices::openUrl(QUrl::fromUserInput("path/to/the/file"));
@ -
Excellent, thank you very much!