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
qqmlpreviewobjectpatch_p.h
Go to the documentation of this file.
1// Copyright (C) 2026 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 reason:default
4
5#ifndef QQMLPREVIEWOBJECTPATCH_P_H
6#define QQMLPREVIEWOBJECTPATCH_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <private/qv4executablecompilationunit_p.h>
20
21#include <QtCore/qobject.h>
22
23#include <vector>
24
25QT_BEGIN_NAMESPACE
26
27namespace QQmlPreview {
28
29enum class PatchResult: quint8 {
30 Failed, // The diff cannot be applied in place; the caller must do a full reload.
31 Rebuilt, // Component roots were rebuilt; left-over old expressions must be nulled.
32 PatchedInPlace, // Trivial diff: objects kept; their old expressions must be translated.
33};
34
35PatchResult applyDiff(std::vector<QObject *> &objects,
36 const QQmlRefPointer<QV4::ExecutableCompilationUnit> &oldUnit,
37 const QQmlRefPointer<QV4::ExecutableCompilationUnit> &newUnit);
38
39// Translate still-live expressions from oldUnit to the function at the same
40// index in newUnit (or nullptr if there is no newUnit). Re-evaluate them if necessary.
41void refreshBindings(const QQmlRefPointer<QV4::ExecutableCompilationUnit> &oldUnit,
42 const QQmlRefPointer<QV4::ExecutableCompilationUnit> &newUnit = {});
43
44// Point every resolved type reference in the engine that names oldUnit at newUnit.
46 QV4::ExecutionEngine *engine,
47 const QQmlRefPointer<QV4::CompiledData::CompilationUnit> &oldUnit,
48 const QQmlRefPointer<QV4::CompiledData::CompilationUnit> &newUnit);
49
50} // namespace QQmlPreview
51
52QT_END_NAMESPACE
53
54#endif // QQMLPREVIEWOBJECTPATCH_P_H
static std::vector< CompositeLevel > collectCompositeLevels(const CompositeLevel &instanceLevel, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &oldUnit, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &newUnit)
static void refreshVmeMethods(const std::vector< QObject * > &objects, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &newUnit)
void refreshBindings(const QQmlRefPointer< QV4::ExecutableCompilationUnit > &oldUnit, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &newUnit)
static void refreshBindingPropertyData(const QQmlRefPointer< QV4::ExecutableCompilationUnit > &cu, int objectIndex, const QQmlPropertyCache::ConstPtr &cache)
static bool canRebuildComponentRootInPlace(const QQmlRefPointer< QV4::ExecutableCompilationUnit > &oldUnit, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &newUnit, int objectIndex)
static bool translateExpressionFunction(QQmlJavaScriptExpression *expr, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &oldUnit, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &newUnit)
static bool isRebuildableComponentRoot(QObject *object, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &oldUnit, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &newUnit)
static bool hasChangedNonCompositeBaseType(const QQmlRefPointer< QV4::ExecutableCompilationUnit > &oldUnit, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &newUnit, int objectIndex)
static QVarLengthArray< int, 4 > objectIndices(QObject *object, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &oldUnit)
static QQmlPropertyCache::ConstPtr relinkCache(const QQmlRefPointer< QV4::ExecutableCompilationUnit > &cu, int objectIndex, const QQmlPropertyCache::ConstPtr &actualParent)
static void relinkDerivedCaches(const QQmlRefPointer< QV4::ExecutableCompilationUnit > &cu, const QQmlPropertyCache::ConstPtr &oldBaseCache, const QQmlPropertyCache::ConstPtr &newBaseCache)
static BindingKind bindingKind(const QV4::CompiledData::Binding *binding)
void redirectResolvedTypeReferences(QV4::ExecutionEngine *engine, const QQmlRefPointer< QV4::CompiledData::CompilationUnit > &oldUnit, const QQmlRefPointer< QV4::CompiledData::CompilationUnit > &newUnit)
PatchResult applyDiff(std::vector< QObject * > &objects, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &oldUnit, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &newUnit)
static bool isTrivialDiff(const QV4::CompiledData::CompilationUnitDiff &diff, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &oldUnit, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &newUnit)
static void rebuildObject(QObject *object, int cuIndex, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &oldUnit, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &newUnit)
static QQmlPropertyCache::ConstPtr nonCompositeBaseType(const QQmlPropertyCache::ConstPtr &propertyCache)
static void translateAndRefreshExpressionsRecursive(const QQmlRefPointer< QQmlContextData > &context, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &oldUnit, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &newUnit)
static bool changeIsTrivial(const QV4::CompiledData::Change &change, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &oldUnit, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &newUnit)
static QObject * outerRebuildTarget(QObject *object, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &oldUnit, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &newUnit)
static void patchConstantBindings(const std::vector< QObject * > &objects, const QV4::CompiledData::CompilationUnitDiff &diff, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &oldUnit, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &newUnit)
static void remapObjectsToNewUnit(const std::vector< QObject * > &objects, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &oldUnit, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &newUnit)
Combined button and popup list for selecting options.
QQmlRefPointer< QV4::ExecutableCompilationUnit > newCu
QQmlRefPointer< QV4::ExecutableCompilationUnit > oldCu