comparison data/model/ModelDataTableModel.h @ 428:3e1d190048f4

* a bit of progress on retaining current row when sorting changes &c
author Chris Cannam
date Tue, 17 Jun 2008 16:07:56 +0000
parents 72ec275e458b
children 304fd0223fa6
comparison
equal deleted inserted replaced
427:72ec275e458b 428:3e1d190048f4
52 int columnCount(const QModelIndex &parent = QModelIndex()) const; 52 int columnCount(const QModelIndex &parent = QModelIndex()) const;
53 53
54 QModelIndex getModelIndexForFrame(size_t frame) const; 54 QModelIndex getModelIndexForFrame(size_t frame) const;
55 size_t getFrameForModelIndex(const QModelIndex &) const; 55 size_t getFrameForModelIndex(const QModelIndex &) const;
56 56
57 QModelIndex getModelIndexForRow(int row) const;
58
57 void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); 59 void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
60
61 void setCurrentRow(int row);
62 int getCurrentRow();
58 63
59 signals: 64 signals:
60 void frameSelected(size_t); 65 void frameSelected(size_t);
61 void addCommand(Command *); 66 void addCommand(Command *);
67 void currentChanged(const QModelIndex &);
62 68
63 protected slots: 69 protected slots:
64 void modelChanged(); 70 void modelChanged();
65 void modelChanged(size_t, size_t); 71 void modelChanged(size_t, size_t);
66 72
67 protected: 73 protected:
68 TabularModel *m_model; 74 TabularModel *m_model;
69 int m_sortColumn; 75 int m_sortColumn;
70 Qt::SortOrder m_sortOrdering; 76 Qt::SortOrder m_sortOrdering;
77 int m_currentRow;
71 typedef std::vector<int> RowList; 78 typedef std::vector<int> RowList;
72 mutable RowList m_sort; 79 mutable RowList m_sort;
73 mutable RowList m_rsort; 80 mutable RowList m_rsort;
74 int getSorted(int row) const; 81 int getSorted(int row) const;
75 int getUnsorted(int row) const; 82 int getUnsorted(int row) const;
76 void resort() const; 83 void resort() const;
77 void resortNumeric() const; 84 void resortNumeric() const;
78 void resortAlphabetical() const; 85 void resortAlphabetical() const;
86 void clearSort();
79 }; 87 };
80 88
81 #endif 89 #endif