![]() |
Home · All Classes · All Functions · Overviews |
The QDeclarativeComponent class encapsulates a QML component description. More...
#include <QDeclarativeComponent>
Inherits QObject.
This class was introduced in Qt 4.7.
enum | Status { Null, Ready, Loading, Error } |
QDeclarativeComponent ( QDeclarativeEngine * engine, QObject * parent = 0 ) | |
QDeclarativeComponent ( QDeclarativeEngine * engine, const QString & fileName, QObject * parent = 0 ) | |
QDeclarativeComponent ( QDeclarativeEngine * engine, const QUrl & url, QObject * parent = 0 ) | |
virtual | ~QDeclarativeComponent () |
virtual QObject * | beginCreate ( QDeclarativeContext * context ) |
virtual void | completeCreate () |
virtual QObject * | create ( QDeclarativeContext * context = 0 ) |
QDeclarativeContext * | creationContext () const |
QList<QDeclarativeError> | errors () const |
bool | isError () const |
bool | isLoading () const |
bool | isNull () const |
bool | isReady () const |
void | loadUrl ( const QUrl & url ) |
qreal | progress () const |
void | setData ( const QByteArray & data, const QUrl & url ) |
Status | status () const |
QUrl | url () const |
void | progressChanged ( qreal progress ) |
void | statusChanged ( QDeclarativeComponent::Status status ) |
The QDeclarativeComponent class encapsulates a QML component description.
Specifies the loading status of the QDeclarativeComponent.
Constant | Value | Description |
---|---|---|
QDeclarativeComponent::Null | 0 | This QDeclarativeComponent has no data. Call loadUrl() or setData() to add QML content. |
QDeclarativeComponent::Ready | 1 | This QDeclarativeComponent is ready and create() may be called. |
QDeclarativeComponent::Loading | 2 | This QDeclarativeComponent is loading network data. |
QDeclarativeComponent::Error | 3 | An error has occured. Calling errorDescription() to retrieve a description. |
Is true if the component is in the Error state, false otherwise.
Equivalent to status() == QDeclarativeComponent::Error.
Access functions:
bool | isError () const |
Notifier signal:
void | statusChanged ( QDeclarativeComponent::Status status ) |
Is true if the component is in the Loading state, false otherwise.
Equivalent to status() == QDeclarativeComponent::Loading.
Access functions:
bool | isLoading () const |
Notifier signal:
void | statusChanged ( QDeclarativeComponent::Status status ) |
Is true if the component is in the Null state, false otherwise.
Equivalent to status() == QDeclarativeComponent::Null.
Access functions:
bool | isNull () const |
Notifier signal:
void | statusChanged ( QDeclarativeComponent::Status status ) |
Is true if the component is in the Ready state, false otherwise.
Equivalent to status() == QDeclarativeComponent::Ready.
Access functions:
bool | isReady () const |
Notifier signal:
void | statusChanged ( QDeclarativeComponent::Status status ) |
The progress of loading the component, from 0.0 (nothing loaded) to 1.0 (finished).
Access functions:
qreal | progress () const |
Notifier signal:
void | progressChanged ( qreal progress ) |
The component's current status.
Access functions:
Status | status () const |
Notifier signal:
void | statusChanged ( QDeclarativeComponent::Status status ) |
The component URL. This is the URL passed to either the constructor, or the loadUrl() or setData() methods.
Access functions:
QUrl | url () const |
Create a QDeclarativeComponent with no data and give it the specified engine and parent. Set the data with setData().
Create a QDeclarativeComponent from the given fileName and give it the specified parent and engine.
See also loadUrl().
Create a QDeclarativeComponent from the given url and give it the specified parent and engine.
See also loadUrl().
Destruct the QDeclarativeComponent.
This method provides more advanced control over component instance creation. In general, programmers should use QDeclarativeComponent::create() to create a component.
Create an object instance from this component. Returns 0 if creation failed. context specifies the context within which to create the object instance.
When QDeclarativeComponent constructs an instance, it occurs in three steps:
QDeclarativeComponent::beginCreate() differs from QDeclarativeComponent::create() in that it 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 communicate information to an instantiated component, as it allows their initial values to be configured before property bindings take effect.
This method provides more advanced control over component instance creation. In general, programmers should use QDeclarativeComponent::create() to create a component.
Complete a component creation begin with QDeclarativeComponent::beginCreate().
Create an object instance from this component. Returns 0 if creation failed. context specifies the context within which to create the object instance.
If context is 0 (the default), it will create the instance in the engine' s root context.
Returns the QDeclarativeContext the component was created in. This is only valid for components created directly from QML.
Return the list of errors that occured during the last compile or create operation. An empty list is returned if isError() is not set.
Load the QDeclarativeComponent from the provided url.
Emitted whenever the component's loading progress changes. progress will be the current progress between 0.0 (nothing loaded) and 1.0 (finished).
Sets the QDeclarativeComponent to use the given QML data. If url is provided, it is used to set the component name and to provide a base path for items resolved by this component.
Emitted whenever the component's status changes. status will be the new status.
Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies) | Trademarks | Qt 4.7.0 |