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

delete record.
print
Josef Rokos 9 years ago
parent 7d01751c10
commit 09f6266123

@ -34,15 +34,11 @@ public:
{
Q_UNUSED(parent)
if (m_list.isEmpty())
{
return 0;
}
QSharedPointer<T> 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

@ -139,7 +139,7 @@ protected:
{
QSharedPointer<T> entity = m_tableModel->itemFromIndex(tableView()->currentIndex());
service()->erase(entity);
fillData();
m_tableModel->removeRowAt(tableView()->currentIndex());
emit dataChanged();
}
}

Loading…
Cancel
Save