void Relation::setEntity(EntityPtr &e, const EntityPtr &newEntity) { if (e) { G_DISCONNECT(e.data(), &Entity::positionChanged, this, &Relation::recalculateLine); G_DISCONNECT(e.data(), &Entity::sizeChanged, this, &Relation::recalculateLine); } e = newEntity; initEntity(e); }
/** * @brief Class::removeProperty * @param name */ void Class::removeProperty(const QString &name) { if (auto prop = property(name)) { G_DISCONNECT(prop.get(), &Property::methodAdded, this, &Class::onOptionalMethodAdded); G_DISCONNECT(prop.get(), &Property::methodRemoved, this, &Class::onOptionalMethodRemoved); G_DISCONNECT(prop.get(), &Property::fieldAdded, this, &Class::onOptionalFieldAdded); G_DISCONNECT(prop.get(), &Property::fieldRemoved, this, &Class::onOptionalFieldRemoved); m_Properties.removeOne(prop); m_OptionalMethods.remove(prop); m_OptionalFields.remove(prop); } }
void Entity::connect(bool connect) { entity::GraphicEntityData *data = G_ASSERT(m_Type->graphicEntityData()).get(); if (connect) { G_CONNECT(G_ASSERT(m_Type.get()), &common::BasicElement::nameChanged, this, &Entity::redraw); G_CONNECT(this, &Entity::positionChanged, G_ASSERT(data), &entity::GraphicEntityData::onPosChanged); } else { G_DISCONNECT(G_ASSERT(m_Type.get()), &common::BasicElement::nameChanged, this, &Entity::redraw); G_DISCONNECT(this, &Entity::positionChanged, G_ASSERT(data), &entity::GraphicEntityData::onPosChanged); } }
/** * @brief ProjectDatabase::removeRelation * @param id */ void ProjectDatabase::removeRelation(const Common::ID &id) { if (auto relation = m_Relations[id]) { G_DISCONNECT(relation.get(), &Relationship::Relation::idChanged, this, &ProjectDatabase::onRelationIDChanged); emit relationRemoved(); } }