Hi ,
please suggest the way to use QProcess to open an URL (internet browser).
Thanks,
Sam
Printable View
Hi ,
please suggest the way to use QProcess to open an URL (internet browser).
Thanks,
Sam
best way:
Code:
QDesktopServices::openUrl(QUrl(tr("http://discussion.forum.nokia.com/forum/forumdisplay.php?f=40")));
bad way:
Code:
#ifdef Q_WS_WIN result = int(ShellExecuteW(HWND_TOP, 0, rUrl.ucs2(), 0, 0, SW_SHOWNORMAL)) > 32; #else
Code:
// Try a range of browsers available on UNIX, until we (hopefully) // find one that works. Start with the most popular first. QProcess process; bool process_started = false; process_started = process.start(); if (!process_started) { process_started = process.start(); } if (!process_started) { process_started = process.start(); } if (!process_started) { process_started = process.start(); } result = process_started;