Fixed bug when adding record to empty table. Fixed empty row after
delete record.
This commit is contained in:
@@ -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
@@ -139,7 +139,7 @@ protected:
|
||||
{
|
||||
QSharedPointer<T> entity = m_tableModel->itemFromIndex(tableView()->currentIndex());
|
||||
service()->erase(entity);
|
||||
fillData();
|
||||
m_tableModel->removeRowAt(tableView()->currentIndex());
|
||||
emit dataChanged();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user