Guest User

Untitled

a guest
Apr 20th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. class proxyReimpl : public QSortFilterProxyModel
  2. {
  3. protected:
  4.  
  5. virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const
  6. {
  7. QVariant leftData = sourceModel()->data(left);
  8. QVariant rightData = sourceModel()->data(right);
  9. kDebug() << leftData.toString() << "\n" << rightData.toString() << "\n";
  10. return QSortFilterProxyModel::lessThan(left, right);
  11. }
  12. }
  13.  
  14. class CallgrindFunctionsListTModel : public QAbstractItemModel
  15. {
  16. Q_OBJECT
  17.  
  18. public:
  19. CallgrindFunctionsListTModel(CallgrindModel* model);
  20.  
  21. QModelIndex index(int, int, const QModelIndex &parent = QModelIndex()) const;
  22. QModelIndex parent(const QModelIndex&) const;
  23. int rowCount(const QModelIndex &parent = QModelIndex()) const;
  24. int columnCount(const QModelIndex&) const;
  25. QVariant data(const QModelIndex &index, int role) const;
  26. QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
  27. CallgrindCallstackItem *itemForIndex(const QModelIndex &index) const;
  28.  
  29. iCachegrindItem::Columns columnToPosInModelList(int col) const;
  30.  
  31. private:
  32. //here are all my informations centralized
  33. CallgrindModel *m_model;
  34. };
  35.  
  36.  
  37. HERE IS THE SNIPPER CODE THAT DECLARES THE MODEL:
  38. QAbstractItemModel *fctTreeModel = m->getQAbstractItemModel(CallgrindModel::E_FCT_LIST);
  39. proxyReimpl *proxyFctTreeModel = new proxyReimpl();
  40.  
  41. proxyFctTreeModel->setSourceModel( fctTreeModel );
  42.  
  43. ui->FunctionsTreeView->setModel( proxyFctTreeModel );
Add Comment
Please, Sign In to add comment