tags:

views:

127

answers:

2

I am making a qt application which allows the user to select a file and then upon clicking ok, start the associated program with the file already loaded. The program I want to start is java based, and I know how to use QProcess to get it to open, I don't know however how to add the file extension which the user is selecting. Any suggestions?

+1  A: 

Did you try QDesktopServices::openUrl() ?

You can pass your program path and name as an Url (file:///) and it will be openned with a suitable application.

Jérôme
A: 

Sorry for leaving everyone hanging on this one, I actually solved this issue myself. Basically I just used QFileDialog to select my file I wanted to open and created a QString which was the entire command line I needed to use to get my application to run properly, which I opened via QProcess. Thanks for the help anyways.

Phil