Qet graphics table item can be removed from diagram

This commit is contained in:
Claveau Joshua
2020-05-12 11:17:25 +02:00
parent 50f061697c
commit 0015f4a694
11 changed files with 154 additions and 52 deletions

View File

@@ -544,6 +544,24 @@ bool QetGraphicsTableItem::sceneEventFilter(QGraphicsItem *watched, QEvent *even
return false;
}
/**
* @brief QetGraphicsTableItem::itemChange
* @param change
* @param value
* @return
*/
QVariant QetGraphicsTableItem::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
{
//item was removed from scene, we remove the handler
if (change == ItemSceneHasChanged) {
if (!scene() && m_handler_item.scene()) {
m_handler_item.scene()->removeItem(&m_handler_item);
}
}
return QetGraphicsItem::itemChange(change, value);
}
void QetGraphicsTableItem::modelReseted() {
dataChanged(m_model->index(0,0), m_model->index(0,0), QVector<int>());
setToMinimumHeight();