| 1 | // Copyright (C) 2022 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #include "qquicksoundeffect_p.h" |
| 5 | #include <QtQml/qqmlcontext.h> |
| 6 | |
| 7 | QT_BEGIN_NAMESPACE |
| 8 | |
| 9 | QQuickSoundEffect::QQuickSoundEffect(QObject *parent) : QSoundEffect(parent) { } |
| 10 | |
| 11 | void QQuickSoundEffect::qmlSetSource(const QUrl &source) |
| 12 | { |
| 13 | if (m_source == source) |
| 14 | return; |
| 15 | |
| 16 | m_source = source; |
| 17 | const QQmlContext *context = qmlContext(this); |
| 18 | setSource(context ? context->resolvedUrl(source) : source); |
| 19 | emit sourceChanged(source); |
| 20 | } |
| 21 | |
| 22 | QUrl QQuickSoundEffect::qmlSource() const |
| 23 | { |
| 24 | return m_source; |
| 25 | } |
| 26 | |
| 27 | QT_END_NAMESPACE |
| 28 | |
| 29 | #include "moc_qquicksoundeffect_p.cpp" |
| 30 |
