diff --git a/core/autotablemodel.h b/core/autotablemodel.h index 0f465e6..b70f3c3 100644 --- a/core/autotablemodel.h +++ b/core/autotablemodel.h @@ -34,15 +34,11 @@ public: { Q_UNUSED(parent) - if (m_list.isEmpty()) - { - return 0; - } - - QSharedPointer entity = m_list.at(0); - QObject *rawEntity = (QObject*)entity.data(); + QObject *entity = (QObject*)new T(); + int colCount = entity->metaObject()->propertyCount() - 1; + delete entity; - return rawEntity->metaObject()->propertyCount() - 1; + return colCount; } QVariant data(const QModelIndex &index, int role) const diff --git a/core/gridform.h b/core/gridform.h index 27b43e3..ab3bf4d 100644 --- a/core/gridform.h +++ b/core/gridform.h @@ -139,7 +139,7 @@ protected: { QSharedPointer entity = m_tableModel->itemFromIndex(tableView()->currentIndex()); service()->erase(entity); - fillData(); + m_tableModel->removeRowAt(tableView()->currentIndex()); emit dataChanged(); } }