I implemented a custom QAbstractTableModel and I'm using a std::vector for my data objects.
Now I wanted to implement the sort() method, to get my table sorted by column.
That's basically what I do:
void SBStateTableModel::sort (int column, Qt::SortOrder order)
{
emit layoutAboutToBeChanged();
switch (column)
{
case Address:
if (order == Qt::DescendingOrder)
std::sort(states.begin(), states.end(), addr_comp_desc);
else
std::sort(states.begin(), states.end(), addr_comp_asc);
default:
return;
}
emit layoutChanged();
}
But emitting layoutChanged() alone doesn't redraw the view. When mark a row and cycle through them, they get updated as they are being highlighted.
The documentation also speaks about updati