Fixed bug when adding record to empty table. Fixed empty row after

delete record.
This commit is contained in:
2015-12-18 13:54:44 +01:00
parent 7d01751c10
commit 09f6266123
2 changed files with 5 additions and 9 deletions
+4 -8
View File
@@ -34,15 +34,11 @@ public:
{
Q_UNUSED(parent)
if (m_list.isEmpty())
{
return 0;
}
QObject *entity = (QObject*)new T();
int colCount = entity->metaObject()->propertyCount() - 1;
delete entity;
QSharedPointer<T> entity = m_list.at(0);
QObject *rawEntity = (QObject*)entity.data();
return rawEntity->metaObject()->propertyCount() - 1;
return colCount;
}
QVariant data(const QModelIndex &index, int role) const
+1 -1
View File
@@ -139,7 +139,7 @@ protected:
{
QSharedPointer<T> entity = m_tableModel->itemFromIndex(tableView()->currentIndex());
service()->erase(entity);
fillData();
m_tableModel->removeRowAt(tableView()->currentIndex());
emit dataChanged();
}
}