15#include <QtCore/qvarlengtharray.h>
16#include <private/qmetaobject_p.h>
17#include <QtCore/qdebug.h>
134 d->m_data->clearPublicContext();
146 return d->m_data->isValid();
156 return d->m_data->engine();
168 return parent->asQQmlContext();
178 return d->m_data->contextObject();
193 if (
data->isInternal()) {
194 qWarning(
"QQmlContext: Cannot set context object for internal context.");
198 if (!
data->isValid()) {
199 qWarning(
"QQmlContext: Cannot set context object on invalid context.");
203 data->setContextObject(
object);
204 data->refreshExpressions();
216 if (
d->notifyIndex() == -1)
221 if (
data->isInternal()) {
222 qWarning(
"QQmlContext: Cannot set property on internal context.");
226 if (!
data->isValid()) {
227 qWarning(
"QQmlContext: Cannot set property on invalid context.");
231 int idx =
data->propertyIndex(
name);
233 data->addPropertyNameAndIndex(
name,
data->numIdValues() +
d->numPropertyValues());
234 d->appendPropertyValue(
value);
235 data->refreshExpressions();
237 d->setPropertyValue(idx,
value);
241 if (
auto *
obj = qvariant_cast<QObject *>(
value)) {
286 data->setExpressions(expressions);
287 data->setChildContexts(childContexts);
288 data->refreshExpressions();
309 *
target =
object->metaObject()->property(
property->coreIndex()).read(
object);
332 const int idx =
data->propertyIndex(
name);
343 if (idx >=
d->numPropertyValues())
346 return d->propertyValue(idx);
370 return d->m_data->findObjectId(
object);
391 if (
const int propertyIndex =
data->propertyIndex(
name); propertyIndex >= 0) {
392 const int numPropertyValues =
d->numPropertyValues();
393 if (propertyIndex < numPropertyValues)
394 return qvariant_cast<QObject *>(
d->propertyValue(propertyIndex));
395 return data->idValue(propertyIndex - numPropertyValues);
401 return qvariant_cast<QObject *>(
result);
416 return d->m_data->resolvedUrl(
src);
441 return d->m_data->baseUrl();
464 if (
d->propertyValue(contextProperty).userType() != qMetaTypeId<QList<QObject*> >())
476 if (
d->propertyValue(contextProperty).userType() != qMetaTypeId<QList<QObject*> >())
489 if (qvariant_cast<QObject *>(
propertyValue(idx)) != destroyed)
504QQmlContextPrivate::QQmlContextPrivate(
515#include "moc_qqmlcontext.cpp"
static QJSValue fromReturnedValue(QV4::ReturnedValue d)
The QJSValue class acts as a container for Qt/JavaScript data types.
QObject * parent() const
Returns a pointer to the parent object.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
void destroyed(QObject *=nullptr)
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointe...
int propertyIndex(const QString &name) const
void dropDestroyedQObject(const QString &name, QObject *destroyed)
static qsizetype context_count(QQmlListProperty< QObject > *)
void setPropertyValue(int index, const QVariant &value)
static QQmlContextPrivate * get(QQmlContext *context)
QVariant propertyValue(int index) const
static QObject * context_at(QQmlListProperty< QObject > *, qsizetype)
The QQmlContext class defines a context within a QML engine.
QString nameForObject(const QObject *) const
Returns the name of object in this context, or an empty string if object is not named in the context.
bool isValid() const
Returns whether the context is valid.
void setBaseUrl(const QUrl &)
Explicitly sets the url resolvedUrl() will use for relative references to baseUrl.
QUrl baseUrl() const
Returns the base url of the component, or the containing component if none is set.
QQmlContext(QQmlEngine *parent, QObject *objParent=nullptr)
Create a new QQmlContext as a child of engine's root context, and the QObject parent.
QUrl resolvedUrl(const QUrl &) const
Resolves the URL src relative to the URL of the containing component.
QVariant contextProperty(const QString &) const
Returns the value of the name property for this context as a QVariant.
QJSValue importedScript(const QString &name) const
QQmlContext * parentContext() const
Return the context's parent QQmlContext, or \nullptr if this context has no parent or if the parent h...
QObject * objectForName(const QString &) const
QObject * contextObject() const
Return the context object, or \nullptr if there is no context object.
void setContextProperty(const QString &, QObject *)
Set the value of the name property on this context.
void setContextObject(QObject *)
Set the context object.
QQmlEngine * engine() const
Return the context's QQmlEngine, or \nullptr if the context has no QQmlEngine or the QQmlEngine was d...
~QQmlContext() override
Destroys the QQmlContext.
void setContextProperties(const QList< PropertyPair > &properties)
The QQmlEngine class provides an environment for instantiating QML components.
The QQmlListProperty class allows applications to expose list-like properties of QObject-derived clas...
const QQmlPropertyData * property(const K &key, QObject *object, const QQmlRefPointer< QQmlContextData > &context) const
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString toString(FormattingOptions options=FormattingOptions(PrettyDecoded)) const
Returns a string representation of the URL.
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
Combined button and popup list for selecting options.
static const QCssKnownValue properties[NumProperties - 1]
static QDBusError::ErrorType get(const char *name)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLuint64 GLenum void * handle
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
static bool readObjectProperty(const QQmlRefPointer< QQmlContextData > &data, QObject *object, const QString &name, QVariant *target)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent