# HG changeset patch # User Chris Cannam # Date 1213188858 0 # Node ID 64e7bbb255d353743eeb0a197ca5d557725ad0de # Parent d35d4e79c95bd517eaacb8bce998e46ad6ae41ad * A bit more work on the data editor diff -r d35d4e79c95b -r 64e7bbb255d3 data/model/ModelDataTableModel.cpp --- 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() { diff -r d35d4e79c95b -r 64e7bbb255d3 data/model/ModelDataTableModel.h --- 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 *);