Hello every body,
I am using QAbstractTableModel to represent more than 4000,000 record, when I scroll down the view to the end the application size is increased in the memory from 50 MB to 111 MB.
Qt Code:
  1. QVariant SearchModel::data(const QModelIndex &index, int role) const
  2. {
  3. if(!index.isValid())
  4. return QVariant();
  5. switch(role)
  6. {
  7. case Qt::DisplayRole:
  8. {
  9. switch(index.column())
  10. {
  11. case 0: // serial
  12. {
  13. return index.row()+1;
  14. }
  15. break;
  16. case 1: // text
  17. {
  18. return m_pSearchEngine->getHighlightedText(index.row(), false);
  19. }
  20. break;
  21. case 2: // book name
  22. {
  23. return m_pSearchEngine->getBookName(index.row());
  24. }
  25. break;
  26. case 3:
  27. {
  28. return m_pSearchEngine->getTitle(index.row());
  29. }
  30. break;
  31. case 4: // part no
  32. return m_pSearchEngine->getPartNo(index.row());
  33. break;
  34. case 5: // page no
  35. return m_pSearchEngine->getPageNo(index.row());
  36. break;
  37. }
  38. }
  39. break;
  40. }
  41. return QVariant();
  42. }
To copy to clipboard, switch view to plain text mode 
I examined the functions I used it just return strings.
How can I decrease the amount of memory that the model take?
Thank you