Hello,

At the moment i am developing an apllication for displaying database contents by QTableView and QAbstractTableModel.
For this purpose i wrote a test application to check the performance. I set only 200 rows and 37 columns but the whole applications slows a bit down. Additionaly the selection of cells is relatively slow.
Is there any way to increase the performance of this test application?

Test.h
Qt Code:
  1. class Model: public QAbstractTableModel
  2. {
  3. Q_OBJECT
  4. public:
  5. Model();
  6. virtual int rowCount( const QModelIndex &parent) const;
  7. virtual int columnCount(const QModelIndex &parent) const;
  8. virtual QVariant data( const QModelIndex &index, int role) const;
  9. QVariant headerData(
  10. int section,
  11. Qt::Orientation orientation,
  12. int role) const;
  13. };
  14.  
  15. class Window: public QMainWindow
  16. {
  17. Q_OBJECT
  18. public:
  19. Window(QWidget *aParent = 0);
  20. private:
  21. QTableView m_view;
  22. Model m_model;
  23. };
To copy to clipboard, switch view to plain text mode 

Test.cpp
Qt Code:
  1. Model::Model()
  2. {
  3. }
  4.  
  5. //
  6. //-----------------------------------------------------------------------------
  7. int Model::rowCount(const QModelIndex &parent) const
  8. {
  9. return 200;
  10. }
  11.  
  12. //
  13. //-----------------------------------------------------------------------------
  14. int Model::columnCount(const QModelIndex &parent) const
  15. {
  16. return 37;
  17. }
  18.  
  19. //
  20. //-----------------------------------------------------------------------------
  21. QVariant Model::data(const QModelIndex &index, int role) const
  22. {
  23. if (role == Qt::DisplayRole)
  24. {
  25. return QVariant(QString("%1, %2 esfgsdgsdgsdgsdg")
  26. .arg(index.row())
  27. .arg(index.column()));
  28. }
  29. return QVariant();
  30. }
  31.  
  32. //
  33. //-----------------------------------------------------------------------------
  34. QVariant Model::headerData(
  35. int section,
  36. Qt::Orientation orientation,
  37. int role) const
  38. {
  39. if (section < 37)
  40. return QVariant(QString("Spalte: %1").arg(section));
  41. else
  42. return QVariant();
  43. }
  44.  
  45. //
  46. //-----------------------------------------------------------------------------
  47. Window::Window(QWidget *aParent):
  48. QMainWindow(aParent),
  49. m_view(this)
  50. {
  51. setCentralWidget(&m_view);
  52. m_view.setModel(&m_model);
  53. m_view.verticalHeader()->setDefaultSectionSize(17);
  54. }
To copy to clipboard, switch view to plain text mode 

I hope someone can help me.
Thanks in advance.

regards Marco B.