I am trying to open a file with the system’s default text editor, cross-platform. However, the file type will have a default application other than the text-editor.
For example, say the file is file.html
, and in my system, HTML files are set to be opened by default using a web-browser.
Calling QDesktopServices::openUrl(QUrl::fromLocalFile(file_path))
would open the file in the web-browser, and although this is correct, it is not what I want.
I would like to open the HTML file in the default text editor.
Ps. HTML was just an example, there can be various custom file extensions for my files. No matter the extension, I still want to force opening the file with the application that is default for editing .txt
files in the system.
1