if (m_rowNumsForItems.contains(item.ObjectId) == false)
{
/// if the item isn't already in the list, it is added, and the resulting rownum recorded.
if (rowCount() - m_lastUpdatedRow == 10)
{
beginInsertRows
(QModelIndex(), m_lastUpdatedRow, rowCount
());
}
m_items.push_back(item);
m_rowNumsForItems.insert(item.ObjectId, rowCount() - 1);
if (rowCount() - m_lastUpdatedRow == 11)
{
endInsertRows();
m_lastUpdatedRow = rowCount();
}
}
else
{
/// if the item is in the list, it is replaced and dataChanged is emitted.
rowNum = m_rowNumsForItems.value(item.ObjectId);
m_items.replace(rowNum, item);
emit dataChanged(index(rowNum, 0), index(rowNum, columnCount() - 1));
}
if (m_rowNumsForItems.contains(item.ObjectId) == false)
{
/// if the item isn't already in the list, it is added, and the resulting rownum recorded.
if (rowCount() - m_lastUpdatedRow == 10)
{
beginInsertRows(QModelIndex(), m_lastUpdatedRow, rowCount());
}
m_items.push_back(item);
m_rowNumsForItems.insert(item.ObjectId, rowCount() - 1);
if (rowCount() - m_lastUpdatedRow == 11)
{
endInsertRows();
m_lastUpdatedRow = rowCount();
}
}
else
{
/// if the item is in the list, it is replaced and dataChanged is emitted.
rowNum = m_rowNumsForItems.value(item.ObjectId);
m_items.replace(rowNum, item);
emit dataChanged(index(rowNum, 0), index(rowNum, columnCount() - 1));
}
To copy to clipboard, switch view to plain text mode
Bookmarks