0

在 c++ 中从 Ubuntu 范围打开 url 的正确方法是什么?(这是 Ubuntu touch 特定的)

这是我尝试过的(从 ActivationResponse 调用此函数。):

static void open_url(std::string const& uri) {
//    url_dispatch_send(uri.c_str(), NULL, NULL);
/*    
 *    I found this in the libertine-scope, but I wasn't able to import
 *    the right libraries
 */

//    Qt.openUrlExternally(uri.c_str());
/*    
 *    I found this at https://developer.ubuntu.com/en/phone/platform/guides/url-dispatcher-guide/ 
 *    and https://developer.ubuntu.com/en/phone/apps/qml/tutorials/register-your-app-url-dispatcher/
 *    but it is actually meant to be used in QML, so it isn't recognized.
 *    I hoped it would work by using QtQuick or QtQml
 */

//    QDesktopServices::openUrl(QUrl(QString(uri), QUrl::TolerantMode));
//    QDesktopServices::openUrl(QUrl("http://www.google.com", QUrl::TolerantMode));
/*    
 *    I found this at https://developer.ubuntu.com/en/phone/platform/guides/url-dispatcher-guide/ 
 *    and http://doc.qt.io/qt-5/qdesktopservices.html#openUrl
 *    this compiles, but the scope crashes on execution.
 *    
 */
}
4

0 回答 0