Qt 4.8
Public Functions | List of all members
QDeclarativeDomComponent Class Reference

The QDeclarativeDomComponent class represents sub-component within a QML document. More...

#include <qdeclarativedom_p.h>

Inheritance diagram for QDeclarativeDomComponent:
QDeclarativeDomObject

Public Functions

QDeclarativeDomObject componentRoot () const
 Returns the component's root object. More...
 
QDeclarativeDomComponentoperator= (const QDeclarativeDomComponent &)
 Assign other to this QDeclarativeDomComponent. More...
 
 QDeclarativeDomComponent ()
 Construct an empty QDeclarativeDomComponent. More...
 
 QDeclarativeDomComponent (const QDeclarativeDomComponent &)
 Create a copy of other QDeclarativeDomComponent. More...
 
 ~QDeclarativeDomComponent ()
 Destroy the QDeclarativeDomComponent. More...
 
- Public Functions inherited from QDeclarativeDomObject
QByteArray customTypeData () const
 If this object represents a custom type, returns the data associated with the custom type, otherwise returns an empty QByteArray(). More...
 
QList< QDeclarativeDomDynamicPropertydynamicProperties () const
 
QDeclarativeDomDynamicProperty dynamicProperty (const QByteArray &) const
 
bool isComponent () const
 Returns true if this object is a sub-component object. More...
 
bool isCustomType () const
 Returns true if this object is a custom type. More...
 
bool isValid () const
 Returns true if this is a valid QDeclarativeDomObject, false otherwise. More...
 
int length () const
 
Returns the length in the input data from where the property assignment star

ted upto the end of it, or -1 if the property is invalid. More...

 
QByteArray objectClassName () const
 Returns the type name as referenced in the qml file. More...
 
QString objectId () const
 Returns the QML id assigned to this object, or an empty QByteArray if no id has been assigned. More...
 
QByteArray objectType () const
 Returns the fully-qualified type name of this object. More...
 
int objectTypeMajorVersion () const
 
int objectTypeMinorVersion () const
 
QDeclarativeDomObjectoperator= (const QDeclarativeDomObject &)
 Assign other to this QDeclarativeDomObject. More...
 
int position () const
 
Returns the position in the input data where the property assignment started

, or -1 if the property is invalid. More...

 
QList< QDeclarativeDomPropertyproperties () const
 Returns the list of assigned properties on this object. More...
 
QDeclarativeDomProperty property (const QByteArray &) const
 Returns the object's name property if a value has been assigned to it, or an invalid QDeclarativeDomProperty otherwise. More...
 
 QDeclarativeDomObject ()
 Construct an invalid QDeclarativeDomObject. More...
 
 QDeclarativeDomObject (const QDeclarativeDomObject &)
 Create a copy of other QDeclarativeDomObject. More...
 
QDeclarativeDomComponent toComponent () const
 Returns a QDeclarativeDomComponent for this object if it is a sub-component, or an invalid QDeclarativeDomComponent if not. More...
 
QUrl url () const
 
 ~QDeclarativeDomObject ()
 Destroy the QDeclarativeDomObject. More...
 

Detailed Description

The QDeclarativeDomComponent class represents sub-component within a QML document.

Warning
This function is not part of the public interface.
Sub-components are QDeclarativeComponents defined within a QML document.  The
following example shows the definition of a sub-component with the id
"listDelegate".
id: listDelegate
Text {
text: modelData.text
}
}
}

Like QDeclarativeDomDocument's, components contain a single root object.

Definition at line 262 of file qdeclarativedom_p.h.

Constructors and Destructors

◆ QDeclarativeDomComponent() [1/2]

QDeclarativeDomComponent::QDeclarativeDomComponent ( )

Construct an empty QDeclarativeDomComponent.

Definition at line 1727 of file qdeclarativedom.cpp.

1728 {
1729 }

◆ QDeclarativeDomComponent() [2/2]

QDeclarativeDomComponent::QDeclarativeDomComponent ( const QDeclarativeDomComponent other)

Create a copy of other QDeclarativeDomComponent.

Definition at line 1734 of file qdeclarativedom.cpp.

1735 : QDeclarativeDomObject(other)
1736 {
1737 }
QDeclarativeDomObject()
Construct an invalid QDeclarativeDomObject.

◆ ~QDeclarativeDomComponent()

QDeclarativeDomComponent::~QDeclarativeDomComponent ( )

Destroy the QDeclarativeDomComponent.

Definition at line 1742 of file qdeclarativedom.cpp.

1743 {
1744 }

Functions

◆ componentRoot()

QDeclarativeDomObject QDeclarativeDomComponent::componentRoot ( ) const

Returns the component's root object.

In the example below, the root object is the "Text" object.

id: listDelegate
Text {
text: modelData.text
}
}
}

Definition at line 1770 of file qdeclarativedom.cpp.

1771 {
1773  if (d->object) {
1774  QDeclarativeParser::Object *obj = 0;
1775  if (d->object->defaultProperty &&
1776  d->object->defaultProperty->values.count() == 1 &&
1777  d->object->defaultProperty->values.at(0)->object)
1778  obj = d->object->defaultProperty->values.at(0)->object;
1779 
1780  if (obj) {
1781  rv.d->object = obj;
1782  rv.d->object->addref();
1783  }
1784  }
1785 
1786  return rv;
1787 }
QDeclarativeParser::Object * object
QSharedDataPointer< QDeclarativeDomObjectPrivate > d
The QDeclarativeDomObject class represents an object instantiation.

◆ operator=()

QDeclarativeDomComponent & QDeclarativeDomComponent::operator= ( const QDeclarativeDomComponent other)

Assign other to this QDeclarativeDomComponent.

Definition at line 1749 of file qdeclarativedom.cpp.

1750 {
1751  static_cast<QDeclarativeDomObject &>(*this) = other;
1752  return *this;
1753 }
The QDeclarativeDomObject class represents an object instantiation.

The documentation for this class was generated from the following files: