Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, April 2008
open external file by system application.


Message 1 in thread

I know that QProcess can open external file and communicate with it. If I
want to open a text file, I use QProcess to call up "TextEdit" (on Mac). But
if I want my program work on Windows which does not have "TextEdit", how can
I do that?
I believe there must exist something in Qt that I can use to let the system
itself decide which program need to be called to open a specific file. For
example, if I want to open a doc file (test.doc) on windows, it will call
"M$office"; when I want to open a avi file, it will call media player.

Is such thing exist in Qt? It must be I think (QUrl ? )

Thanks in advance.
Dave.

Message 2 in thread

PÃ Fredag 18 april 2008 , 06:04:29 skrev Dave Sun:
> I know that QProcess can open external file and communicate with it. If I
> want to open a text file, I use QProcess to call up "TextEdit" (on Mac).
> But if I want my program work on Windows which does not have "TextEdit",
> how can I do that?
> I believe there must exist something in Qt that I can use to let the system
> itself decide which program need to be called to open a specific file. For
> example, if I want to open a doc file (test.doc) on windows, it will call
> "M$office"; when I want to open a avi file, it will call media player.
>
> Is such thing exist in Qt? It must be I think (QUrl ? )

Have a look at QDesktopServices::openUrl(). Works like a charm. :)

> Thanks in advance.
> Dave.

--
 [ signature omitted ] 

Message 3 in thread

I have  to transform an xml document in pdf format and visualize it.

I use QProcess to launch xmltopdf tool and after that,
I use QDesktopServices::openUrl(generatedfile.pdf) to visualize the pdf.
system use the pdf editor installed.


Christopher Rasch-Olsen Raa a Ãcrit :
> PÃ Fredag 18 april 2008 , 06:04:29 skrev Dave Sun:
>   
>> I know that QProcess can open external file and communicate with it. If I
>> want to open a text file, I use QProcess to call up "TextEdit" (on Mac).
>> But if I want my program work on Windows which does not have "TextEdit",
>> how can I do that?
>> I believe there must exist something in Qt that I can use to let the system
>> itself decide which program need to be called to open a specific file. For
>> example, if I want to open a doc file (test.doc) on windows, it will call
>> "M$office"; when I want to open a avi file, it will call media player.
>>
>> Is such thing exist in Qt? It must be I think (QUrl ? )
>>     
>
> Have a look at QDesktopServices::openUrl(). Works like a charm. :)
>
>   
>> Thanks in advance.
>> Dave.
>>     
>
> --
> Christopher
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
>