std::size_t operator()(const Id<SegmentModel>& id) const { if(!id) return -1; return *id.val(); }
SlotModel::SlotModel( const Id<SlotModel>& id, RackModel* parent) : IdentifiedObject<SlotModel> {id, Metadata<ObjectKey_k, SlotModel>::get(), parent} { initConnections(); metadata.setName(QString{"Slot.%1"}.arg(*id.val())); }
void SlotModel::putToFront( const Id<Process::LayerModel>& id) { if(!id.val()) return; if(id != m_frontLayerModelId) { m_frontLayerModelId = id; emit layerModelPutToFront(layers.at(id)); } }
void ConstraintViewModel::showRack(const Id<RackModel>& rackId) { if(rackId.val().is_initialized()) { m_shownRack = rackId; emit rackShown(m_shownRack); } else { hideRack(); } }
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())); }