summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm/qwasmservices.cpp
blob: b9f48090e1b8e2b0763f915db3e57f1400393e44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright (C) 2018 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#include "qwasmservices.h"
#include "qwasmstring.h"

#include <QtCore/QUrl>
#include <QtCore/QDebug>

#include <emscripten/val.h>

QT_BEGIN_NAMESPACE

bool QWasmServices::openUrl(const QUrl &url)
{
    emscripten::val jsUrl = QWasmString::fromQString(url.toString());
    emscripten::val::global("window").call<void>("open", jsUrl, emscripten::val("_blank"));
    return true;
}

QT_END_NAMESPACE