diff options
author | Jerome Pasion <jerome.pasion@nokia.com> | 2010-12-20 16:29:06 (GMT) |
---|---|---|
committer | Jerome Pasion <jerome.pasion@nokia.com> | 2010-12-20 16:29:06 (GMT) |
commit | 9b0ad342cc888bd4291c84f63fe485bfbfdc3ce0 (patch) | |
tree | ccaf02b27ceb7c11fbf451d5abfefe28b2f6d682 /src/declarative/qml | |
parent | 401e43aa33a3c1a914f4280190a9d514a6fe0918 (diff) | |
download | Qt-9b0ad342cc888bd4291c84f63fe485bfbfdc3ce0.zip Qt-9b0ad342cc888bd4291c84f63fe485bfbfdc3ce0.tar.gz Qt-9b0ad342cc888bd4291c84f63fe485bfbfdc3ce0.tar.bz2 |
Re-organized the Qt Quick page. Changed titles and links.
Task-number: QTBUG-16071
Diffstat (limited to 'src/declarative/qml')
-rw-r--r-- | src/declarative/qml/qdeclarativecomponent.cpp | 52 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativecontext.cpp | 46 |
2 files changed, 49 insertions, 49 deletions
diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index 77fc925..edc7b2a 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -135,7 +135,7 @@ class QByteArray; } \endcode - \sa {Using QML in C++ Applications}, {Integrating QML with existing Qt UI code} + \sa {Using QML Bindings in C++ Applications}, {Integrating QML Code with Existing Qt UI Code} */ /*! @@ -157,7 +157,7 @@ class QByteArray; \snippet doc/src/snippets/declarative/component.qml 0 - Notice that while a \l Rectangle by itself would be automatically + Notice that while a \l Rectangle by itself would be automatically rendered and displayed, this is not the case for the above rectangle because it is defined inside a \c Component. The component encapsulates the QML elements within, as if they were defined in a separate QML @@ -227,7 +227,7 @@ class QByteArray; /*! \enum QDeclarativeComponent::Status - + Specifies the loading status of the QDeclarativeComponent. \value Null This QDeclarativeComponent has no data. Call loadUrl() or setData() to add QML content. @@ -279,8 +279,8 @@ void QDeclarativeComponentPrivate::clear() typeData->release(); typeData = 0; } - - if (cc) { + + if (cc) { cc->release(); cc = 0; } @@ -436,12 +436,12 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeEngine *engine, const Q } /*! - Create a QDeclarativeComponent from the given \a fileName and give it the specified + Create a QDeclarativeComponent from the given \a fileName and give it the specified \a parent and \a engine. \sa loadUrl() */ -QDeclarativeComponent::QDeclarativeComponent(QDeclarativeEngine *engine, const QString &fileName, +QDeclarativeComponent::QDeclarativeComponent(QDeclarativeEngine *engine, const QString &fileName, QObject *parent) : QObject(*(new QDeclarativeComponentPrivate), parent) { @@ -480,7 +480,7 @@ void QDeclarativeComponent::setData(const QByteArray &data, const QUrl &url) d->url = url; QDeclarativeTypeData *typeData = QDeclarativeEnginePrivate::get(d->engine)->typeLoader.get(data, url); - + if (typeData->isCompleteOrError()) { d->fromTypeData(typeData); } else { @@ -615,7 +615,7 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeComponentPrivate &dd, Q /*! \qmlmethod object Component::createObject(Item parent) - Creates and returns an object instance of this component that will have the given + Creates and returns an object instance of this component that will have the given \a parent. Returns null if object creation fails. The object will be created in the same context as the one in which the component @@ -623,8 +623,8 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeComponentPrivate &dd, Q which were not created in QML. If you wish to create an object without setting a parent, specify \c null for - the \a parent value. Note that if the returned object is to be displayed, you - must provide a valid \a parent value or set the returned object's \l{Item::parent}{parent} + the \a parent value. Note that if the returned object is to be displayed, you + must provide a valid \a parent value or set the returned object's \l{Item::parent}{parent} property, or else the object will not be visible. Dynamically created instances can be deleted with the \c destroy() method. @@ -669,7 +669,7 @@ QScriptValue QDeclarativeComponent::createObject(QObject* parent) } } - if (needParent) + if (needParent) qWarning("QDeclarativeComponent: Created graphical object was not placed in the graphics scene."); } completeCreate(); @@ -682,7 +682,7 @@ QScriptValue QDeclarativeComponent::createObject(QObject* parent) /*! Create an object instance from this component. Returns 0 if creation failed. \a context specifies the context within which to create the object - instance. + instance. If \a context is 0 (the default), it will create the instance in the engine' s \l {QDeclarativeEngine::rootContext()}{root context}. @@ -699,7 +699,7 @@ QObject *QDeclarativeComponent::create(QDeclarativeContext *context) return rv; } -QObject *QDeclarativeComponentPrivate::create(QDeclarativeContextData *context, +QObject *QDeclarativeComponentPrivate::create(QDeclarativeContextData *context, const QBitField &bindings) { if (!context) @@ -712,21 +712,21 @@ QObject *QDeclarativeComponentPrivate::create(QDeclarativeContextData *context, /*! This method provides more advanced control over component instance creation. - In general, programmers should use QDeclarativeComponent::create() to create a + In general, programmers should use QDeclarativeComponent::create() to create a component. Create an object instance from this component. Returns 0 if creation failed. \a context specifies the context within which to create the object - instance. + instance. When QDeclarativeComponent constructs an instance, it occurs in three steps: \list 1 \i The object hierarchy is created, and constant values are assigned. \i Property bindings are evaluated for the the first time. \i If applicable, QDeclarativeParserStatus::componentComplete() is called on objects. - \endlist + \endlist QDeclarativeComponent::beginCreate() differs from QDeclarativeComponent::create() in that it - only performs step 1. QDeclarativeComponent::completeCreate() must be called to + only performs step 1. QDeclarativeComponent::completeCreate() must be called to complete steps 2 and 3. This breaking point is sometimes useful when using attached properties to @@ -777,7 +777,7 @@ QDeclarativeComponentPrivate::beginCreate(QDeclarativeContextData *context, cons return begin(context, creationContext, cc, start, count, &state, 0, bindings); } -QObject * QDeclarativeComponentPrivate::begin(QDeclarativeContextData *parentContext, +QObject * QDeclarativeComponentPrivate::begin(QDeclarativeContextData *parentContext, QDeclarativeContextData *componentCreationContext, QDeclarativeCompiledData *component, int start, int count, ConstructionState *state, QList<QDeclarativeError> *errors, @@ -789,7 +789,7 @@ QObject * QDeclarativeComponentPrivate::begin(QDeclarativeContextData *parentCon Q_ASSERT(!isRoot || state); // Either this isn't a root component, or a state data must be provided Q_ASSERT((state != 0) ^ (errors != 0)); // One of state or errors (but not both) must be provided - if (isRoot) + if (isRoot) QDeclarativeDebugTrace::startRange(QDeclarativeDebugTrace::Creating); QDeclarativeContextData *ctxt = new QDeclarativeContextData; @@ -798,7 +798,7 @@ QObject * QDeclarativeComponentPrivate::begin(QDeclarativeContextData *parentCon ctxt->imports = component->importCache; // Nested global imports - if (componentCreationContext && start != -1) + if (componentCreationContext && start != -1) ctxt->importedScripts = componentCreationContext->importedScripts; component->importCache->addref(); @@ -850,7 +850,7 @@ void QDeclarativeComponentPrivate::beginDeferred(QDeclarativeEnginePrivate *engi QDeclarativeVME vme; vme.runDeferred(object); - if (vme.isError()) + if (vme.isError()) state->errors = vme.errors(); if (isRoot) { @@ -877,13 +877,13 @@ void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePri if (state->completePending) { for (int ii = 0; ii < state->bindValues.count(); ++ii) { - QDeclarativeEnginePrivate::SimpleList<QDeclarativeAbstractBinding> bv = + QDeclarativeEnginePrivate::SimpleList<QDeclarativeAbstractBinding> bv = state->bindValues.at(ii); for (int jj = 0; jj < bv.count; ++jj) { if(bv.at(jj)) { // XXX akennedy bv.at(jj)->m_mePtr = 0; - bv.at(jj)->setEnabled(true, QDeclarativePropertyPrivate::BypassInterceptor | + bv.at(jj)->setEnabled(true, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); } } @@ -891,7 +891,7 @@ void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePri } for (int ii = 0; ii < state->parserStatus.count(); ++ii) { - QDeclarativeEnginePrivate::SimpleList<QDeclarativeParserStatus> ps = + QDeclarativeEnginePrivate::SimpleList<QDeclarativeParserStatus> ps = state->parserStatus.at(ii); for (int jj = ps.count - 1; jj >= 0; --jj) { @@ -942,7 +942,7 @@ void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePri /*! This method provides more advanced control over component instance creation. - In general, programmers should use QDeclarativeComponent::create() to create a + In general, programmers should use QDeclarativeComponent::create() to create a component. Complete a component creation begin with QDeclarativeComponent::beginCreate(). diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp index 3ee0e6f..dff90b4 100644 --- a/src/declarative/qml/qdeclarativecontext.cpp +++ b/src/declarative/qml/qdeclarativecontext.cpp @@ -72,10 +72,10 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() Contexts allow data to be exposed to the QML components instantiated by the QML engine. - Each QDeclarativeContext contains a set of properties, distinct from its QObject - properties, that allow data to be explicitly bound to a context by name. The - context properties are defined and updated by calling - QDeclarativeContext::setContextProperty(). The following example shows a Qt model + Each QDeclarativeContext contains a set of properties, distinct from its QObject + properties, that allow data to be explicitly bound to a context by name. The + context properties are defined and updated by calling + QDeclarativeContext::setContextProperty(). The following example shows a Qt model being bound to a context and then accessed from a QML file. \code @@ -97,8 +97,8 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() To simplify binding and maintaining larger data sets, a context object can be set on a QDeclarativeContext. All the properties of the context object are available by name in the context, as though they were all individually added through calls - to QDeclarativeContext::setContextProperty(). Changes to the property's values are - detected through the property's notify signal. Setting a context object is both + to QDeclarativeContext::setContextProperty(). Changes to the property's values are + detected through the property's notify signal. Setting a context object is both faster and easier than manually adding and maintaing context property values. The following example has the same effect as the previous one, but it uses a context @@ -121,7 +121,7 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() component.create(context); \endcode - All properties added explicitly by QDeclarativeContext::setContextProperty() take + All properties added explicitly by QDeclarativeContext::setContextProperty() take precedence over the context object's properties. \section2 The Context Hierarchy @@ -147,8 +147,8 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() context2->setContextProperty("b", 15); \endcode - While QML objects instantiated in a context are not strictly owned by that - context, their bindings are. If a context is destroyed, the property bindings of + While QML objects instantiated in a context are not strictly owned by that + context, their bindings are. If a context is destroyed, the property bindings of outstanding QML objects will stop evaluating. \warning Setting the context object or adding new context properties after an object @@ -156,7 +156,7 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() to reevaluate). Thus whenever possible you should complete "setup" of the context before using it to create any objects. - \sa {Using QML in C++ Applications} + \sa {Using QML Bindings in C++ Applications} */ /*! \internal */ @@ -223,7 +223,7 @@ QDeclarativeContext::~QDeclarativeContext() /*! Returns whether the context is valid. - To be valid, a context must have a engine, and it's contextObject(), if any, + To be valid, a context must have a engine, and it's contextObject(), if any, must not have been deleted. */ bool QDeclarativeContext::isValid() const @@ -384,7 +384,7 @@ QVariant QDeclarativeContext::contextProperty(const QString &name) const if (data->contextObject) { QObject *obj = data->contextObject; QDeclarativePropertyCache::Data local; - QDeclarativePropertyCache::Data *property = + QDeclarativePropertyCache::Data *property = QDeclarativePropertyCache::property(data->engine, obj, name, local); if (property) value = obj->metaObject()->property(property->coreIndex).read(obj); @@ -461,7 +461,7 @@ QUrl QDeclarativeContext::baseUrl() const { Q_D(const QDeclarativeContext); const QDeclarativeContextData* data = d->data; - while (data && data->url.isEmpty()) + while (data && data->url.isEmpty()) data = data->parent; if (data) @@ -515,7 +515,7 @@ QDeclarativeContextData::QDeclarativeContextData(QDeclarativeContext *ctxt) void QDeclarativeContextData::invalidate() { - while (childContexts) + while (childContexts) childContexts->invalidate(); while (componentAttached) { @@ -570,7 +570,7 @@ void QDeclarativeContextData::clearContext() void QDeclarativeContextData::destroy() { - if (linkedContext) + if (linkedContext) linkedContext->destroy(); if (engine) invalidate(); @@ -626,9 +626,9 @@ void QDeclarativeContextData::setParent(QDeclarativeContextData *p) } } -/* -Refreshes all expressions that could possibly depend on this context. Refreshing flushes all -context-tree dependent caches in the expressions, and should occur every time the context tree +/* +Refreshes all expressions that could possibly depend on this context. Refreshing flushes all +context-tree dependent caches in the expressions, and should occur every time the context tree *structure* (not values) changes. */ void QDeclarativeContextData::refreshExpressions() @@ -656,7 +656,7 @@ void QDeclarativeContextData::addObject(QObject *o) data->outerContext = this; data->nextContextObject = contextObjects; - if (data->nextContextObject) + if (data->nextContextObject) data->nextContextObject->prevContextObject = &data->nextContextObject; data->prevContextObject = &contextObjects; contextObjects = data; @@ -664,7 +664,7 @@ void QDeclarativeContextData::addObject(QObject *o) void QDeclarativeContextData::addImportedScript(const QDeclarativeParser::Object::ScriptBlock &script) { - if (!engine) + if (!engine) return; QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine); @@ -684,7 +684,7 @@ void QDeclarativeContextData::addImportedScript(const QDeclarativeParser::Object scriptContext->pushScope(enginePriv->contextClass->newUrlContext(url)); scriptContext->pushScope(enginePriv->globalClass->staticGlobalObject()); - + QScriptValue scope = QScriptDeclarativeClass::newStaticScopeObject(scriptEngine); scriptContext->pushScope(scope); @@ -752,7 +752,7 @@ QString QDeclarativeContextData::findObjectId(const QObject *obj) const for (int i=0; i<idValueCount; i++) { if (idValues[i] == obj) return propertyNames->findId(i); - } + } if (linkedContext) return linkedContext->findObjectId(obj); @@ -761,7 +761,7 @@ QString QDeclarativeContextData::findObjectId(const QObject *obj) const QDeclarativeContext *QDeclarativeContextData::asQDeclarativeContext() { - if (!publicContext) + if (!publicContext) publicContext = new QDeclarativeContext(this); return publicContext; } |