4#ifndef QQMLCOMPONENT_P_H
5#define QQMLCOMPONENT_P_H
22#include <private/qqmlobjectcreator_p.h>
23#include <private/qqmltypedata_p.h>
24#include <private/qqmlguardedcontextdata_p.h>
26#include <QtCore/QString>
27#include <QtCore/QStringList>
28#include <QtCore/QList>
29#include <QtCore/qtclasshelpermacros.h>
31#include <private/qobject_p.h>
49 QObject *beginCreate(QQmlRefPointer<QQmlContextData>);
50 void completeCreate();
52 static void setInitialProperties(
58 virtual void incubateObject(
62 const QQmlRefPointer<QQmlContextData> &
context,
63 const QQmlRefPointer<QQmlContextData> &forContext);
69 void fromTypeData(
const QQmlRefPointer<QQmlTypeData> &
data);
79 bool hadTopLevelRequiredProperties()
const;
110 m_creatorOrRequiredProperties.swap(
other.m_creatorOrRequiredProperties);
115 inline void ensureRequiredPropertyStorage();
117 inline void addPendingRequiredProperty(
120 inline bool hasUnsetRequiredProperties()
const;
121 inline void clearRequiredProperties();
123 inline void appendErrors(
const QList<QQmlError> &qmlErrors);
124 inline void appendCreatorErrors();
129 inline bool hasCreator()
const;
131 const QQmlRefPointer<QV4::ExecutableCompilationUnit> &compilationUnit,
132 const QQmlRefPointer<QQmlContextData> &creationContext);
135 inline bool isCompletePending()
const;
136 inline void setCompletePending(
bool isPending);
139 QBiPointer<QQmlObjectCreator, RequiredProperties> m_creatorOrRequiredProperties;
170 bool isBound()
const {
return compilationUnit && (compilationUnit->componentsAreBound()); }
180 if (m_creatorOrRequiredProperties.
isT1())
181 delete m_creatorOrRequiredProperties.
asT1();
183 delete m_creatorOrRequiredProperties.
asT2();
188 errors = std::move(
other.errors);
189 m_creatorOrRequiredProperties = std::exchange(
other.m_creatorOrRequiredProperties, {});
197 if (m_creatorOrRequiredProperties.isNull())
199 else if (m_creatorOrRequiredProperties.isT1())
200 return m_creatorOrRequiredProperties.asT1()->requiredProperties();
202 return m_creatorOrRequiredProperties.asT2();
209 requiredProperties()->insert({
object, propData},
info);
219 if (
auto reqProps = requiredProperties())
226 errors.emplaceBack(e);
234 auto creatorErrorCount =
creator()->errors.size();
235 if (creatorErrorCount == 0)
237 auto existingErrorCount = errors.size();
238 errors.resize(existingErrorCount + creatorErrorCount);
246 if (m_creatorOrRequiredProperties.isT1())
247 return m_creatorOrRequiredProperties.asT1();
253 if (m_creatorOrRequiredProperties.isT1())
254 return m_creatorOrRequiredProperties.asT1();
265 if (m_creatorOrRequiredProperties.isT1()) {
266 delete m_creatorOrRequiredProperties.asT1();
273 if (m_creatorOrRequiredProperties.isT1())
274 delete m_creatorOrRequiredProperties.asT1();
276 delete m_creatorOrRequiredProperties.asT2();
280 return m_creatorOrRequiredProperties.asT1();
285 return m_creatorOrRequiredProperties.flag();
290 m_creatorOrRequiredProperties.setFlagValue(isPending);
301 Q_ASSERT(m_creatorOrRequiredProperties.isT2() || m_creatorOrRequiredProperties.isNull());
302 if (m_creatorOrRequiredProperties.isNull())
static QObjectPrivate * get(QObject *o)
QQmlRefPointer< QV4::ExecutableCompilationUnit > compilationUnit
std::vector< ConstructionState > DeferredState
std::unique_ptr< QString > inlineComponentName
static QQmlComponentPrivate * get(QQmlComponent *c)
QQmlGuardedContextData creationContext
QQmlRefPointer< QQmlTypeData > typeData
@ CreateWarnAboutRequiredProperties
The QQmlComponent class encapsulates a QML component definition.
CompilationMode
Specifies whether the QQmlComponent should load the component immediately, or asynchonously.
The QQmlContext class defines a context within a QML engine.
The QQmlEngine class provides an environment for instantiating QML components.
The QQmlError class encapsulates a QML error.
The QQmlIncubator class allows QML objects to be created asynchronously.
The QQmlProperty class abstracts accessing properties on objects created from QML.
\macro QT_RESTRICTED_CAST_FROM_ASCII
Combined button and popup list for selecting options.
static const QCssKnownValue properties[NumProperties - 1]
DBusConnection const char DBusError * error
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLsizei const GLfloat * v
[13]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLdouble GLdouble GLdouble GLdouble q
static qreal component(const QPointF &point, unsigned int i)
QQmlContext * qmlContext(const QObject *obj)
static void initCreator(QQmlData::DeferredData *deferredData, const QQmlRefPointer< QQmlContextData > &contextData, QQmlComponentPrivate::ConstructionState *immediateState)
static bool isTransient(const QWindow *w)
QItemEditorCreatorBase * creator
AnnotatedQmlError()=default
AnnotatedQmlError(QQmlError error, bool transient)
AnnotatedQmlError(QQmlError error)
void clearRequiredProperties()
bool isCompletePending() const
void ensureRequiredPropertyStorage()
QList< AnnotatedQmlError > errors
void appendErrors(const QList< QQmlError > &qmlErrors)
bool hasUnsetRequiredProperties() const
QQmlObjectCreator * creator()
void addPendingRequiredProperty(const QObject *object, const QQmlPropertyData *propData, const RequiredPropertyInfo &info)
void setCompletePending(bool isPending)
void swap(ConstructionState &other)
void appendCreatorErrors()
QQmlObjectCreator * initCreator(QQmlRefPointer< QQmlContextData > parentContext, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &compilationUnit, const QQmlRefPointer< QQmlContextData > &creationContext)
ConstructionState()=default
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QQmlComponentPrivate::ConstructionState)
RequiredProperties * requiredProperties()