PDA

View Full Version : Opening a browser in MAC



gren15
30th June 2009, 14:14
I use 'ShellExecute' on windows to launch the browser with my URL string.

Does QT have options for which I can do the same on a MAC?
Any pointers will be useful.
Thanks.

Lykurg
30th June 2009, 14:30
Hi, have you seen QDesktopServices::openUrl()?

gren15
30th June 2009, 17:54
Thanks Lykurg!!!

This was exactly what I wanted. It is so good to see that QT now (rather from 4.2) has this function, it eases the whole process of launching the browser.

Out of curiosity, does it take care of the issue on Vista machines where depending on the user privileges a file attempted to opened has to get the 'consent prompt'




//****************************************
// On Windows XP
//****************************************

ShellExecute(
NULL,
"open",
sCompletePath,
NULL,
NULL,
SW_SHOWNORMAL );


//****************************************
// On Windows Vista
//****************************************

ShellExecute(
NULL,
"runas",//<------------------ on Vista machines
sCompletePath,
NULL, // params
NULL, // directory
SW_SHOWNORMAL);