Results 1 to 8 of 8

Thread: How to open a document with the default application?

  1. #1
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Question How to open a document with the default application?

    Hi all, in my app I need to open a document (PDF) with the default application to view this kind of docs in the system. I've tried calling QProcess:start() with the path of the doc but it doesn't works. Could you tell me how to do it? Thanks.

  2. #2
    Join Date
    Mar 2006
    Posts
    172
    Thanks
    30
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to open a document with the default application?

    Quote Originally Posted by SkripT
    Hi all, in my app I need to open a document (PDF) with the default application to view this kind of docs in the system. I've tried calling QProcess:start() with the path of the doc but it doesn't works. Could you tell me how to do it? Thanks.
    on linux: if you are using KDE give the following

    kfmclient exec <filename>

    GNOME:
    gnome-open <filename>

    Cheers

    Nupul.

  3. #3
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to open a document with the default application?

    Quote Originally Posted by nupul
    on linux: if you are using KDE give the following

    kfmclient exec <filename>

    GNOME:
    gnome-open <filename>

    Cheers

    Nupul.
    Thanks Nupul, but I don't use linux. I'm using Windows XP Moreover, I want to know if there's a general way to make it, without dependency of the operating system, if it's possible.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to open a document with the default application?

    Try QDS's Launcher service.
    J-P Nurmi

  5. #5
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to open a document with the default application?

    Thanks jpn, but I think that finally I will make it using QProcess testing the operating system and calling it with the apropiate args like Nupul has comented...

  6. #6
    Join Date
    Mar 2006
    Posts
    172
    Thanks
    30
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Cool Re: How to open a document with the default application?

    Quote Originally Posted by SkripT
    Thanks Nupul, but I don't use linux. I'm using Windows XP Moreover, I want to know if there's a general way to make it, without dependency of the operating system, if it's possible.
    No, there is no way that I can think of to make it OS independent. See Linux uses MIME types to do the bindings with the possible apps that can handle those files. kfclient is used to manage this info of default apps etc....Windows :P may be using some technique similar...I have actually forgotten how to open a file by default app...did it long time ago and am still scouring my head for replies!!! If you ever get the answer to this lemme know too!!

    Nupul

  7. The following user says thank you to nupul for this useful post:

    SkripT (30th April 2006)

  8. #7
    Join Date
    Jan 2006
    Location
    Minsk, Brest, Belarus
    Posts
    54
    Thanks
    3
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Red face Re: How to open a document with the default application?

    If you want I can post my class written for Windows to launch default application.

  9. The following user says thank you to Xagen for this useful post:

    SkripT (30th April 2006)

  10. #8
    Join Date
    Jan 2006
    Location
    Mountain View, CA
    Posts
    279
    Thanked 42 Times in 37 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to open a document with the default application?

    Quote Originally Posted by SkripT
    Thanks Nupul, but I don't use linux. I'm using Windows XP Moreover, I want to know if there's a general way to make it, without dependency of the operating system, if it's possible.
    There's no OS independant way. If you're using windows, use the ShellExecute() function. Check the msdn docs for more info.
    Save yourself some pain. Learn C++ before learning Qt.

  11. The following user says thank you to Chicken Blood Machine for this useful post:

    SkripT (30th April 2006)

Similar Threads

  1. Replies: 7
    Last Post: 5th January 2009, 08:27
  2. Replies: 7
    Last Post: 24th November 2008, 11:22
  3. How open my application in other PCs without Qt?
    By Colx007 in forum Installation and Deployment
    Replies: 1
    Last Post: 2nd June 2008, 15:34
  4. How to open IGES files in Qt Application?
    By Shuchi Agrawal in forum Newbie
    Replies: 1
    Last Post: 21st February 2007, 01:06
  5. Application default font
    By larry104 in forum Qt Programming
    Replies: 2
    Last Post: 16th September 2006, 01:24

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.