I wonder how to open a link in a default user browser using Qt (that would open it across all platforms (Win Mac Lin))?
To create Qt-based web applications, Qt provides interfaces that support a wide range of standard web techologies such as HTML, CSS, and JavaScript. These interfaces enable applications to embed content from the World Wide Web.
Qt Creator is a cross-platform IDE for C++ and QML.
Graphics in Qt 5 is primarily done either through the imperative QPainter API, or through Qt's declarative UI language, Qt Quick, and its scene graph back-end. Qt 5's graphics capabilities also includes support for printing, as well as the loading and saving of various image formats.
In the doc: QDesktopServices
http://doc.qt.io/qt-4.8/qdesktopservices.html#openUrl
bool QDesktopServices::openUrl ( const QUrl & url ) [static]
Opens the given url in the appropriate Web browser for the user's desktop environment, and returns true if successful; otherwise returns false.
You can try this code
QString link = "http://www.google.com";
QDesktopServices::openUrl(QUrl(link));
Read QDesktopServices and QUrl to get further information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With