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)
|
Q_UNUSED(parent)
|
||||||
|
|
||||||
if (m_list.isEmpty())
|
QObject *entity = (QObject*)new T();
|
||||||
{
|
int colCount = entity->metaObject()->propertyCount() - 1;
|
||||||
return 0;
|
delete entity;
|
||||||
}
|
|
||||||
|
|
||||||
QSharedPointer<T> entity = m_list.at(0);
|
return colCount;
|
||||||
QObject *rawEntity = (QObject*)entity.data();
|
|
||||||
|
|
||||||
return rawEntity->metaObject()->propertyCount() - 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant data(const QModelIndex &index, int role) const
|
QVariant data(const QModelIndex &index, int role) const
|
||||||
|
|||||||
+1
-1
@@ -139,7 +139,7 @@ protected:
|
|||||||
{
|
{
|
||||||
QSharedPointer<T> entity = m_tableModel->itemFromIndex(tableView()->currentIndex());
|
QSharedPointer<T> entity = m_tableModel->itemFromIndex(tableView()->currentIndex());
|
||||||
service()->erase(entity);
|
service()->erase(entity);
|
||||||
fillData();
|
m_tableModel->removeRowAt(tableView()->currentIndex());
|
||||||
emit dataChanged();
|
emit dataChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user