This is my NonMerge method:

Qt Code:
  1. void TxTableModel::parseXml(const QByteArray &xml)
  2. {
  3. QXmlInputSource inputSource;
  4. TxSaxTableHandler handler(&m_Data, false);
  5.  
  6. inputSource.setData(xml);
  7. reader.setContentHandler(&handler);
  8. reader.setErrorHandler(&handler);
  9.  
  10. QModelIndexList selectedList = parent->selectionModel()->selectedRows();
  11. QModelIndex scrollTopIndex = parent->indexAt(QPoint(1, 1));
  12. QModelIndex scrollBottomIndex = parent->indexAt(QPoint(1, parent->height() - 1));
  13.  
  14. beginResetModel();
  15. m_Data.clearData();
  16. reader.parse(inputSource);
  17. endResetModel();
  18.  
  19. if (scrollBottomIndex.row() == -1) {
  20. parent->scrollToBottom();
  21. } else {
  22. parent->scrollTo(scrollTopIndex);
  23. }
  24.  
  25. if (selectedList.count() > 0 && (selectedList.at(0).row() >= scrollTopIndex.row()) && (scrollBottomIndex.row() == -1 || scrollBottomIndex.row() > selectedList.at(0).row() )) {
  26. parent->selectRow(selectedList.at(0).row());
  27. }
  28. }
To copy to clipboard, switch view to plain text mode 

But I really hope that you would not use this. It makes me a lot of pain to support (edit cell is something terrible) and I`m working on merge too.