SlotModel::SlotModel( std::function<void(const SlotModel&, SlotModel&)> lmCopyMethod, const SlotModel& source, const id_type<SlotModel>& id, RackModel *parent): IdentifiedObject<SlotModel> {id, "SlotModel", parent}, m_frontLayerModelId {source.frontLayerModel() }, // Keep the same id. m_height {source.height() } { lmCopyMethod(source, *this); }
SlotModel::SlotModel( std::function<void(const SlotModel&, SlotModel&)> lmCopyMethod, const SlotModel& source, const Id<SlotModel>& id, RackModel *parent): IdentifiedObject<SlotModel> {id, Metadata<ObjectKey_k, SlotModel>::get(), parent}, m_frontLayerModelId{Id<Process::LayerModel>{source.m_frontLayerModelId.val()}}, m_height {source.height() } { initConnections(); lmCopyMethod(source, *this); // Note: we have a small trick for the layer model id. // Since we're cloning, we want the pointer cached in the layer model to be the // one we have cloned, hence instead of just copying the id, we ask the corresponding // layer model to give us its id. // TODO this is f*****g ugly - mostly because two objects exist with the same id... metadata = source.metadata; metadata.setName(QString{"Slot.%1"} .arg(*id.val())); }