Sorting QtTableModel - QTableView doesn't get updated
问题 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; }