Exemplo n.º 1
0
void QDeclarativeBasePositionerPrivate::watchChanges(QGraphicsObject *other)
{
    if (QGraphicsItemPrivate::get(other)->isDeclarativeItem) {
        QDeclarativeItemPrivate *otherPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(other));
        otherPrivate->addItemChangeListener(this, watchedChanges);
    } else {
        Q_Q(QDeclarativeBasePositioner);
        QObject::connect(other, SIGNAL(widthChanged()), q, SLOT(graphicsWidgetGeometryChanged()));
        QObject::connect(other, SIGNAL(heightChanged()), q, SLOT(graphicsWidgetGeometryChanged()));
        QObject::connect(other, SIGNAL(opacityChanged()), q, SLOT(graphicsWidgetGeometryChanged()));
        QObject::connect(other, SIGNAL(visibleChanged()), q, SLOT(graphicsWidgetGeometryChanged()));
    }
}
Exemplo n.º 2
0
void QDeclarativeAnchorsPrivate::addDepend(QGraphicsObject *item)
{
    if (!item)
        return;
    QGraphicsItemPrivate * itemPrivate = QGraphicsItemPrivate::get(item);
    if (itemPrivate->isDeclarativeItem) {
        QDeclarativeItemPrivate *p =
            static_cast<QDeclarativeItemPrivate *>(QGraphicsItemPrivate::get(item));
        p->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry);
    } else if(itemPrivate->isWidget) {
        Q_Q(QDeclarativeAnchors);
        QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item);
        QObject::connect(widget, SIGNAL(destroyed(QObject*)), q, SLOT(_q_widgetDestroyed(QObject*)));
        QObject::connect(widget, SIGNAL(geometryChanged()), q, SLOT(_q_widgetGeometryChanged()));
    }
}
Exemplo n.º 3
0
void QDeclarativeLoaderPrivate::initResize()
{
    Q_Q(QDeclarativeLoader);
    if (QDeclarativeItem *qmlItem = qobject_cast<QDeclarativeItem*>(item)) {
        QDeclarativeItemPrivate *p =
                static_cast<QDeclarativeItemPrivate *>(QGraphicsItemPrivate::get(qmlItem));
        p->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry);
        // We may override the item's size, so we need to remember
        // whether the item provided its own valid size.
        itemWidthValid = p->widthValid;
        itemHeightValid = p->heightValid;
    } else if (item && item->isWidget()) {
        QGraphicsWidget *widget = static_cast<QGraphicsWidget*>(item);
        widget->installEventFilter(q);
    }
    _q_updateSize();
}
Exemplo n.º 4
0
void QDeclarativeBasePositionerPrivate::watchChanges(QDeclarativeItem *other)
{
    QDeclarativeItemPrivate *otherPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(other));
    otherPrivate->addItemChangeListener(this, watchedChanges);
}