bool MyTableModel::removeRows(int row, int count, const QModelIndex &parent)
{
if (row < 0 || count<1 || row + count>rowCount())
return false;
//需要将操作放到beginRemoveRows和endRemoveRows两个函数调用之间
beginRemoveRows(parent, row, row + count - 1);
if (m_DeleteList.size() != 0)
{
for (int i = 0; i < m_DeleteList.size(); i++)
{
modelData.removeAt(m_DeleteList[i]);
}
}
// for(int i=row+count-1;i>=row;i--)
// {
// //移除该行数据
// modelData.removeAt(i);
// }
m_DeleteList.clear();
endRemoveRows();
return true;
}