Mercurial > hg > svcore
changeset 419:64e7bbb255d3
* A bit more work on the data editor
author | Chris Cannam |
---|---|
date | Wed, 11 Jun 2008 12:54:18 +0000 |
parents | d35d4e79c95b |
children | 50a956688baa |
files | data/model/ModelDataTableModel.cpp data/model/ModelDataTableModel.h |
diffstat | 2 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/data/model/ModelDataTableModel.cpp Wed Jun 11 12:53:20 2008 +0000 +++ b/data/model/ModelDataTableModel.cpp Wed Jun 11 12:54:18 2008 +0000 @@ -296,6 +296,16 @@ return createIndex(dist, 0, 0); } +size_t +ModelDataTableModel::getFrameForModelIndex(const QModelIndex &index) const +{ + int row = index.row(); + if (m_rows.empty()) return 0; + if (row < 0) row == 0; + if (row > m_rows.size()-1) row = m_rows.size()-1; + return m_rows[row]; +} + void ModelDataTableModel::modelChanged() {
--- a/data/model/ModelDataTableModel.h Wed Jun 11 12:53:20 2008 +0000 +++ b/data/model/ModelDataTableModel.h Wed Jun 11 12:54:18 2008 +0000 @@ -48,6 +48,7 @@ int columnCount(const QModelIndex &parent = QModelIndex()) const; QModelIndex getModelIndexForFrame(size_t frame) const; + size_t getFrameForModelIndex(const QModelIndex &) const; static bool canHandleModelType(Model *);