Results 1 to 5 of 5

Thread: Invoking a browser...???

  1. #1
    Join Date
    Jan 2007
    Posts
    29
    Thanks
    6
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Invoking a browser...???

    Hello all,

    I want to invoke a browser from my project to display the documentation of my project.

    what i am using is

    Qt Code:
    1. system("firefox xyz.html")
    To copy to clipboard, switch view to plain text mode 

    This is giving me trouble. If the user doesn't have that browser, how can he view the documentation. So i tried this way

    Qt Code:
    1. if ( system ("firefox xyz.html" ) )
    2. {
    3. if ( system ("konqueror xyz.html" ) )
    4. {
    5. .
    6. .
    To copy to clipboard, switch view to plain text mode 

    this worked fine. But i didn't noticed on that time that we cannot access the project and the browser simultaneously. we can access my project only after closing the browser.

    so what i thought was, i can run in the background.

    Qt Code:
    1. if ( system ("firefox xyz.html &" ) )
    2. {
    3. if ( system ("konqueror xyz.html &" ) )
    4. {
    5. .
    6. .
    To copy to clipboard, switch view to plain text mode 

    but this lead to another problem. If the first browser is not present, then its ok. If it is there, then the next browser also opened along with the first one.

    I dont know how to tackle this....

    please help
    Deepu

  2. #2
    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: Invoking a browser...???

    How about QProcess?
    J-P Nurmi

  3. #3
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Invoking a browser...???

    Or could you not use one of the Qt classes to render the html instead of launching an external browser?

    Maybe QTextBrowser...

  4. #4
    Join Date
    May 2007
    Location
    Netherlands
    Posts
    11
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Invoking a browser...???

    In qt 4.2 there is a new class for opening html files into a configured browser: QDesktopServices
    Succes,

  5. The following user says thank you to Jeroen van der Waal for this useful post:

    ntp (6th August 2008)

  6. #5
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Thanks
    3
    Thanked 74 Times in 54 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Invoking a browser...???

    Quote Originally Posted by Jeroen van der Waal View Post
    In qt 4.2 there is a new class for opening html files into a configured browser: QDesktopServices
    I second this recommendation. It works very well. In addition, it will launch the user's preferred browser, instead of the one you chose.

Similar Threads

  1. Web browser on Mac OS
    By pkloc in forum Qt Programming
    Replies: 2
    Last Post: 22nd March 2007, 01:21
  2. How a server can write "Hello" to a browser ?
    By probine in forum Qt Programming
    Replies: 2
    Last Post: 1st December 2006, 14:43
  3. Text Browser Link Question
    By taylor34 in forum Qt Programming
    Replies: 2
    Last Post: 20th June 2006, 19:54
  4. Opening swf file in the default browser
    By munna in forum Qt Programming
    Replies: 16
    Last Post: 5th May 2006, 09:33
  5. Need Basic html Browser
    By awalesminfo in forum Newbie
    Replies: 6
    Last Post: 21st March 2006, 17:14

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.