Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqmlnotifyingblob.cpp
Go to the documentation of this file.
1// Copyright (C) 2025 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// Qt-Security score:significant
4
6
8
9QQmlNotifyingBlob::Callback::~Callback() = default;
10
11void QQmlNotifyingBlob::Callback::ready(QQmlNotifyingBlob *) {}
12void QQmlNotifyingBlob::Callback::progress(QQmlNotifyingBlob *, qreal) {}
13
14void QQmlNotifyingBlob::registerCallback(Callback *callback)
15{
16 assertEngineThread();
17 Q_ASSERT(!m_callbacks.contains(callback));
18 m_callbacks.append(callback);
19}
20
21void QQmlNotifyingBlob::unregisterCallback(Callback *callback)
22{
23 assertEngineThreadIfRunning();
24 Q_ASSERT(m_callbacks.contains(callback));
25 m_callbacks.removeOne(callback);
26 Q_ASSERT(!m_callbacks.contains(callback));
27}
28
29void QQmlNotifyingBlob::completed()
30{
31 assertEngineThread();
32 // Notify callbacks
33 while (!m_callbacks.isEmpty()) {
34 Callback *callback = m_callbacks.takeFirst();
35 callback->ready(this);
36 }
37}
38
39void QQmlNotifyingBlob::downloadProgressChanged(qreal p)
40{
41 assertEngineThread();
42
43 for (Callback *callback : std::as_const(m_callbacks))
44 callback->progress(this, p);
45}
46
47QT_END_NAMESPACE
Combined button and popup list for selecting options.