void WatchVector::attachFpData(PixelBox *f, QString name) { int idx; if (!f) { return; } if (!getNumFreeMappings()) { return; } if (getIndexFromPixelBox(f) != -1) { return; } /* Fill empty slot with attachment */ idx = getFirstFreeMapping(); m_pData[idx] = f; m_qName[idx] = name; m_nActiveMappings++; connect(f, SIGNAL(dataChanged()), this, SLOT(updateData())); connect(f, SIGNAL(dataDeleted()), this, SLOT(detachData())); connect(this->m_pImageView, SIGNAL(minMaxAreaChanged(const QRect&)), f, SLOT(setMinMaxArea(const QRect&))); connect(this->m_pImageView, SIGNAL(setMappingBounds()), this, SLOT(updateAllMinMax())); connect(f, SIGNAL(minMaxAreaChanged()), this, SLOT(onMinMaxAreaChanged())); addMappingOptions(idx); updateGUI(); }
VertexBox::~VertexBox() { emit dataDeleted(); delete[] m_pData; delete[] m_pDataMap; delete[] m_nMinData; delete[] m_nMaxData; delete[] m_nAbsMinData; delete[] m_nAbsMaxData; }
bool VertexTableModel::addVertexBox(VertexBox *vb, QString &name) { for (int i = 0; i < m_pData.count(); i++) { if (m_pData[i] == vb) { return false; } } m_pData.append(vb); m_Names.append(name); connect(vb, SIGNAL(dataDeleted()), this, SLOT(detachData())); connect(vb, SIGNAL(dataChanged()), this, SLOT(updateData())); reset(); return true; }
void VertexTableModel::detachData(void) { VertexBox *vb = static_cast<VertexBox*>(sender()); int idx = m_pData.indexOf(vb); if (idx >= 0) { m_pData.removeAt(idx); m_Names.removeAt(idx); reset(); } emit dataDeleted(idx); if (m_pData.isEmpty()) { emit empty(); } }
PixelBox::~PixelBox() { emit dataDeleted(); delete[] m_pDataMap; }