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
qqmlvme.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 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 "qqmlvme_p.h"
5
6#include <private/qmetaobjectbuilder_p.h>
7#include "qqmlengine.h"
8#include <QtQml/private/qqmlcomponent_p.h>
9
10#include <QStack>
11#include <QPointF>
12#include <QSizeF>
13#include <QRectF>
14#include <QtCore/qdebug.h>
15#include <QtCore/qvarlengtharray.h>
16#include <QtCore/qcoreapplication.h>
17#include <QtCore/qdatetime.h>
18#include <QtCore/qvarlengtharray.h>
19#include <QtQml/qjsvalue.h>
20
22
23bool QQmlVME::s_enableComponentComplete = true;
24
25void QQmlVME::enableComponentComplete()
26{
27 s_enableComponentComplete = true;
28}
29
30void QQmlVME::disableComponentComplete()
31{
32 s_enableComponentComplete = false;
33}
34
35bool QQmlVME::componentCompleteEnabled()
36{
37 return s_enableComponentComplete;
38}
39
41: m_objectCount(0), m_objects(nullptr), m_contextCount(0), m_contexts(nullptr)
42{
43}
44
49
50void QQmlVMEGuard::guard(QQmlObjectCreator *creator)
51{
52 clear();
53
54 std::vector<QQmlGuard<QObject>> &objects = creator->allCreatedObjects();
55 m_objectCount = objects.size();
56 m_objects = new QQmlGuard<QObject>[m_objectCount];
57 for (size_t ii = 0; ii < m_objectCount; ++ii)
58 m_objects[ii] = objects[ii];
59
60 m_contextCount = 1;
61 m_contexts = new QQmlGuardedContextData[m_contextCount];
62 m_contexts[0] = creator->parentContextData();
63}
64
66{
67 delete [] m_objects;
68 delete [] m_contexts;
69
70 m_objectCount = 0;
71 m_objects = nullptr;
72 m_contextCount = 0;
73 m_contexts = nullptr;
74}
75
76bool QQmlVMEGuard::isOK() const
77{
78 for (size_t ii = 0; ii < m_objectCount; ++ii)
79 if (m_objects[ii].isNull())
80 return false;
81
82 for (int ii = 0; ii < m_contextCount; ++ii)
83 if (m_contexts[ii].isNull() || !m_contexts[ii]->engine())
84 return false;
85
86 return true;
87}
88
89QT_END_NAMESPACE
bool isOK() const
Definition qqmlvme.cpp:76
void clear()
Definition qqmlvme.cpp:65