tags:

views:

43

answers:

1

I am using PyQt4's QTextBroswer to display a html link.

Whenever users click on the link, a browser will be used to open the internet page.

My question is, is there a way to set so that our own prefered browser is used to open the url page instead of the preset one?

Thanks in advance.

+1  A: 

QTextBrowser provides an actual browser. If you want to open a document in the user's desktop environment-specified browser, then you'd use QDesktopServices::openUrl.

You can use QProcess to start random programs:

QObject *parent;
...
QString program = "/path/to/browser";
QStringList arguments;
arguments << "--your-browser-url-option-if-any" << "http://www.example.com";

QProcess *myProcess = new QProcess(parent);
myProcess->start(program, arguments);
Pedro Silva
Yeah, I saw that in the trolltech site, but just couldn't seem to get a clue how to use the QUrl to set our own desired browser.Can please explain to me more detail about it? Sorry I'm kinda new to these browser thingie.
lionel319
You can't. You can either use QTextBrowser's own browser, QDesktopServices::openUrl with the user's default browser, or QProcess and start the browser you want with the link as an argument.
Pedro Silva