42 #include "private/qdeclarativeloader_p_p.h" 51 : item(0),
component(0), ownComponent(false), updatingSize(false),
52 itemWidthValid(false), itemHeightValid(false)
62 if (resizeItem ==
item) {
275 if (
d->source == url)
282 if (
d->source.isEmpty()) {
291 d->ownComponent =
true;
331 if (comp ==
d->component)
337 d->ownComponent =
false;
360 if (!q->isComponentComplete() || !
component)
367 q,
SLOT(_q_sourceLoaded()));
370 emit q->statusChanged();
371 emit q->progressChanged();
372 emit q->sourceChanged();
373 emit q->itemChanged();
384 emit q->sourceChanged();
385 emit q->statusChanged();
386 emit q->progressChanged();
391 if (!creationContext) creationContext =
qmlContext(q);
428 emit q->sourceChanged();
429 emit q->statusChanged();
430 emit q->progressChanged();
431 emit q->itemChanged();
529 return d->component->progress();
537 if (!
item || updatingSize)
543 q->setImplicitWidth(qmlItem->implicitWidth());
545 q->setImplicitWidth(qmlItem->width());
546 if (loaderGeometryChanged && q->widthValid())
547 qmlItem->setWidth(q->width());
548 if (!itemHeightValid)
549 q->setImplicitHeight(qmlItem->implicitHeight());
551 q->setImplicitHeight(qmlItem->height());
552 if (loaderGeometryChanged && q->heightValid())
553 qmlItem->setHeight(q->height());
557 q->setImplicitWidth(widgetSize.
width());
558 if (loaderGeometryChanged && q->widthValid())
560 q->setImplicitHeight(widgetSize.
height());
561 if (loaderGeometryChanged && q->heightValid())
563 if (widget->
size() != widgetSize)
564 widget->
resize(widgetSize);
566 updatingSize =
false;
585 if (newGeometry != oldGeometry) {
595 if (
d->item &&
d->item->isWidget()) {
596 d->item->removeEventFilter(
this);
597 d->item->installEventFilter(
this);
607 if (
d->item &&
d->item->isWidget())
608 d->_q_updateSize(
false);
613 #include <moc_qdeclarativeloader_p.cpp> The QVariant class acts like a union for the most common Qt data types.
Status
Emitted after component "startup" has completed.
#define QT_END_NAMESPACE
This macro expands to.
QPointer< QWidget > widget
QDeclarativeParserStatus ** d
QVariant itemChange(GraphicsItemChange change, const QVariant &value)
Note that unlike QGraphicsItems, QDeclarativeItem::itemChange() is not called during initial widget p...
void setSource(const QUrl &)
bool isComponentComplete() const
Returns true if construction of the QML component is complete; otherwise returns false.
qreal width() const
Returns the width.
void setParentItem(QGraphicsItem *parent)
Sets this item's parent item to newParent.
qreal height() const
Returns the height.
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
GraphicsItemChange
This enum describes the state changes that are notified by QGraphicsItem::itemChange().
The QUrl class provides a convenient interface for working with URLs.
T * qobject_cast(QObject *object)
void setWidth(qreal w)
Sets the width to the given width.
The QObject class is the base class of all Qt objects.
Q_DECLARATIVE_EXPORT QDeclarativeContext * qmlContext(const QObject *)
The QSizeF class defines the size of a two-dimensional object using floating point precision...
void setVisible(bool visible)
If visible is true, the item is made visible.
void setContextObject(QObject *)
Set the context object.
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QRectF class defines a rectangle in the plane using floating point precision. ...
The QDeclarativeComponent class encapsulates a QML component definition.
The QDeclarativeItem class provides the most basic of all visual items in QML.
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
void addItemChangeListener(QDeclarativeItemChangeListener *listener, ChangeTypes types)
void removeItem(QGraphicsItem *item)
Removes the item item and all its children from the scene.
qreal height() const
Returns the height of the rectangle.
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
This function is called to handle this item's changes in geometry from oldGeometry to newGeometry...
QDeclarativeComponent * component
qreal width() const
Returns the width of the rectangle.
~QDeclarativeLoaderPrivate()
void resetSourceComponent()
static qreal component(const QPointF &point, unsigned int i)
QDeclarativeLoaderPrivate()
virtual void itemGeometryChanged(QDeclarativeItem *, const QRectF &, const QRectF &)
QDeclarativeLoader(QDeclarativeItem *parent=0)
virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
This function is called to handle this item's changes in geometry from oldGeometry to newGeometry...
virtual bool eventFilter(QObject *, QEvent *)
Filters events if this object has been installed as an event filter for the watched object...
QGraphicsObject * item() const
void removeItemChangeListener(QDeclarativeItemChangeListener *, ChangeTypes types)
Q_DECLARATIVE_EXPORT QDeclarativeEngine * qmlEngine(const QObject *)
virtual QVariant itemChange(GraphicsItemChange, const QVariant &)
Note that unlike QGraphicsItems, QDeclarativeItem::itemChange() is not called during initial widget p...
void QDeclarative_setParent_noEvent(QObject *object, QObject *parent)
Makes the object a child of parent.
void _q_updateSize(bool loaderGeometryChanged=true)
virtual void componentComplete()
void installEventFilter(QObject *)
Installs an event filter filterObj on this object.
bool isWidget() const
Returns true if this item is a widget (i.
void itemGeometryChanged(QDeclarativeItem *item, const QRectF &newGeometry, const QRectF &oldGeometry)
The QDeclarativeContext class defines a context within a QML engine.
static const QGraphicsItemPrivate * get(const QGraphicsItem *item)
virtual ~QDeclarativeLoader()
void setHeight(qreal h)
Sets the height to the given height.
QGraphicsScene * scene() const
Returns the current scene for the item, or 0 if the item is not stored in a scene.
QDeclarativeInfo qmlInfo(const QObject *me)
The QGraphicsObject class provides a base class for all graphics items that require signals...
void warning(const QDeclarativeError &)
The QEvent class is the base class of all event classes.
Type type() const
Returns the event type.
void setSourceComponent(QDeclarativeComponent *)
QDeclarativeComponent * sourceComponent() const
void deleteLater()
Schedules this object for deletion.
bool eventFilter(QObject *watched, QEvent *e)
Filters events if this object has been installed as an event filter for the watched object...
virtual void completeCreate()
This method provides more advanced control over component instance creation.
friend class QDeclarativeComponent