diff options
Diffstat (limited to 'src/webenginequick/api/qquickwebenginedownloadrequest.cpp')
-rw-r--r-- | src/webenginequick/api/qquickwebenginedownloadrequest.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/webenginequick/api/qquickwebenginedownloadrequest.cpp b/src/webenginequick/api/qquickwebenginedownloadrequest.cpp new file mode 100644 index 000000000..f745ba3b3 --- /dev/null +++ b/src/webenginequick/api/qquickwebenginedownloadrequest.cpp @@ -0,0 +1,32 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "qquickwebenginedownloadrequest_p.h" +#include "QtWebEngineCore/private/qwebenginedownloadrequest_p.h" + +#include "web_contents_adapter_client.h" + +QT_BEGIN_NAMESPACE + +/*! + \internal +*/ +QQuickWebEngineDownloadRequest::QQuickWebEngineDownloadRequest(QWebEngineDownloadRequestPrivate *p, QObject *parent) + : QWebEngineDownloadRequest(p, parent) +{ +} + +/*! + \internal + Returns the WebEngineView the download was requested on. If the download was not triggered by content in a WebEngineView, + \c nullptr is returned. +*/ +QQuickWebEngineView *QQuickWebEngineDownloadRequest::view() const +{ + Q_ASSERT(d_ptr->adapterClient->clientType() == QtWebEngineCore::WebContentsAdapterClient::QmlClient); + return const_cast<QQuickWebEngineView *>(static_cast<const QQuickWebEngineView *>(d_ptr->adapterClient->holdingQObject())); +} + +QT_END_NAMESPACE + +#include "moc_qquickwebenginedownloadrequest_p.cpp" |