PDA

View Full Version : Invoking a browser...???



deepusrp
11th June 2007, 03:51
Hello all,

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

what i am using is


system("firefox xyz.html")

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



if ( system ("firefox xyz.html" ) )
{
if ( system ("konqueror xyz.html" ) )
{
.
.


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.



if ( system ("firefox xyz.html &" ) )
{
if ( system ("konqueror xyz.html &" ) )
{
.
.


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

jpn
11th June 2007, 07:24
How about QProcess?

steg90
11th June 2007, 14:49
Or could you not use one of the Qt classes to render the html instead of launching an external browser?

Maybe QTextBrowser...

Jeroen van der Waal
11th June 2007, 20:57
In qt 4.2 there is a new class for opening html files into a configured browser: QDesktopServices

Succes,

Brandybuck
12th June 2007, 17:32
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.