void MapGraphicsObject::setParent(MapGraphicsObject * nParent)
{
    _parent = nParent;
    if (_constructed)
        this->parentChanged();
    else
        QTimer::singleShot(1, this, SIGNAL(parentChanged()));
}
//private
void PrivateQGraphicsObject::setMGObj(MapGraphicsObject * mgObj)
{
    _mgObj = mgObj;

    if (_mgObj == 0)
        return;

    //Connect signals/slots for all of the changes in the MapGraphicsObject that we must be able to handle
    connect(_mgObj,
            SIGNAL(enabledChanged()),
            this,
            SLOT(handleEnabledChanged()));
    connect(_mgObj,
            SIGNAL(opacityChanged()),
            this,
            SLOT(handleOpacityChanged()));
    connect(_mgObj,
            SIGNAL(parentChanged()),
            this,
            SLOT(handleParentChanged()));
    connect(_mgObj,
            SIGNAL(posChanged()),
            this,
            SLOT(handlePosChanged()));
    connect(_mgObj,
            SIGNAL(rotationChanged()),
            this,
            SLOT(handleRotationChanged()));
    connect(_mgObj,
            SIGNAL(visibleChanged()),
            this,
            SLOT(handleVisibleChanged()));
    connect(_mgObj,
            SIGNAL(zValueChanged()),
            this,
            SLOT(handleZValueChanged()));
    connect(_mgObj,
            SIGNAL(selectedChanged()),
            this,
            SLOT(handleMGSelectedChanged()));
    connect(_mgObj,
            SIGNAL(flagsChanged()),
            this,
            SLOT(handleMGFlagsChanged()));
    connect(mgObj,
            SIGNAL(keyFocusRequested()),
            this,
            SLOT(handleKeyFocusRequested()));

    //Get all of the info about the MGObject
    this->updateAllFromMG();

    connect(mgObj,
            SIGNAL(destroyed()),
            this,
            SLOT(deleteLater()));
}
Example #3
0
Fixture::Fixture(QuasiDeclarativeItem *parent)
    : QuasiDeclarativeItem(parent)
    , m_fixture(0)
    , m_material(0)
    , m_shapeItem(0)
    , m_body(0)
    , m_bodyItem(0)
{
    connect(this, SIGNAL(parentChanged()),
            this, SLOT(onParentChanged()));
}
Example #4
0
File: qnode.cpp Project: RSATom/Qt
// Note: should never be called from the ctor directly as the type may not be fully
// created yet
void QNode::setParent(QNode *parent)
{
    Q_D(QNode);

    // If we already have a parent don't do anything. Be careful to ensure
    // that QNode knows about the parent, not just QObject (by checking the ids)
    if (parentNode() == parent &&
            ((parent != nullptr && d->m_parentId == parentNode()->id()) || parent == nullptr))
        return;
    d->_q_setParentHelper(parent);

    // Block notifications as we want to let the _q_setParentHelper
    // manually handle them
    const bool blocked = blockNotifications(true);
    emit parentChanged(parent);
    blockNotifications(blocked);
}
Example #5
0
void Comment::setData(const JsonObject &data, bool signalChange)
{
    QString id = JSON_GET_STRING(data.value(COMMENT_ID_KEY));
    QString name = JSON_GET_STRING(data.value(COMMENT_NAME_KEY));
    QString url = JSON_GET_STRING(data.value(COMMENT_URL_KEY));
    QString dateString = JSON_GET_STRING(data.value(COMMENT_DATE_KEY));
    QDateTime date = QDateTime::fromString(dateString, DATE_TIME_FORMAT);
    QString content = JSON_GET_STRING(data.value(COMMENT_CONTENT_KEY));
    QString parent = JSON_GET_STRING(data.value(COMMENT_PARENT_KEY));
    if (m_id != id) {
        m_id = id;
        if (signalChange) {
            emit idChanged();
        }
    }
    if (m_name != name) {
        m_name = name;
        if (signalChange) {
            emit nameChanged();
        }
    }
    if (m_url != url) {
        m_url = url;
        if (signalChange) {
            emit urlChanged();
        }
    }
    if (m_date != date) {
        m_date = date;
        if (signalChange) {
            emit dateChanged();
        }
    }
    if (m_content != content) {
        m_content = content;
        if (signalChange) {
            emit contentChanged();
        }
    }
    if (m_parent != parent) {
        m_parent = parent;
        if (signalChange) {
            emit parentChanged();
        }
    }
}
void QmlModelView::nodeInstancePropertyChanged(const ModelNode &node, const QString &propertyName)
{
    if (debug)
        qDebug() << this << __FUNCTION__ << node << propertyName;

    QmlObjectNode qmlObjectNode(node);

    if (!qmlObjectNode.isValid())
        return;

    if (isTransformProperty(propertyName))
        transformChanged(qmlObjectNode, propertyName);
    else if (propertyName == "parent")
        parentChanged(qmlObjectNode);
    else if (propertyName == "state")
        changeToState(node, qmlObjectNode.instanceValue(propertyName).toString());
    else
        otherPropertyChanged(qmlObjectNode, propertyName);
}
void QmlAnchorBindingProxy::setup(const QmlItemNode &fxItemNode)
{
    m_fxItemNode = fxItemNode;

    m_verticalTarget = m_horizontalTarget = m_topTarget = m_bottomTarget = m_leftTarget = m_rightTarget = m_fxItemNode.modelNode().parentProperty().parentModelNode();

    if (topAnchored()) {
        ModelNode targetNode = m_fxItemNode.anchors().instanceAnchor(AnchorLine::Top).qmlItemNode();
        if (targetNode.isValid())
            m_topTarget = targetNode;
    }

    if (bottomAnchored()) {
        ModelNode targetNode = m_fxItemNode.anchors().instanceAnchor(AnchorLine::Bottom).qmlItemNode();
        if (targetNode.isValid())
            m_bottomTarget = targetNode;
    }

    if (leftAnchored()) {
        ModelNode targetNode = m_fxItemNode.anchors().instanceAnchor(AnchorLine::Left).qmlItemNode();
        if (targetNode.isValid())
            m_leftTarget = targetNode;
    }

    if (rightAnchored()) {
        ModelNode targetNode = m_fxItemNode.anchors().instanceAnchor(AnchorLine::Right).qmlItemNode();
        if (targetNode.isValid())
            m_rightTarget = targetNode;
    }

    if (verticalCentered()) {
        ModelNode targetNode = m_fxItemNode.anchors().instanceAnchor(AnchorLine::VerticalCenter).qmlItemNode();
        if (targetNode.isValid())
            m_verticalTarget = targetNode;
    }

    if (horizontalCentered()) {
        ModelNode targetNode = m_fxItemNode.anchors().instanceAnchor(AnchorLine::HorizontalCenter).qmlItemNode();
        if (targetNode.isValid())
            m_horizontalTarget = targetNode;
    }

    emit itemNodeChanged();
    emit parentChanged();
    emit topAnchorChanged();
    emit bottomAnchorChanged();
    emit leftAnchorChanged();
    emit rightAnchorChanged();
    emit centeredHChanged();
    emit centeredVChanged();
    emit anchorsChanged();

    if (m_fxItemNode.hasNodeParent()) {
        emit itemNodeChanged();
        emit topTargetChanged();
        emit bottomTargetChanged();
        emit leftTargetChanged();
        emit rightTargetChanged();
        emit verticalTargetChanged();
        emit horizontalTargetChanged();
    }
}
Example #8
0
void HnModelItem::setParent(const int parent)
{
    m_parent = parent;
    emit parentChanged();
}
Example #9
0
QtMenuBar::QtMenuBar(QDeclarativeItem *parent)
    : QDeclarativeItem(parent), _menuBar(0) /*, _menuBar(new QMenuBar)*/
{
    connect(this, SIGNAL(parentChanged()), this, SLOT(updateParent()));
    setFlag(QGraphicsItem::ItemHasNoContents, true);
}