Mercurial > hg > svcore
comparison data/model/SparseModel.h @ 432:113cf8781bd1
* Fix two problems reported by Matthias in the data editor window:
- highlighted row was incorrect (it was highlighting the row for the
next item after the current position, not the one before it as it
should be)
- making a row current moved the centre frame of the view, but did
not change the playback position as it should do
author | Chris Cannam |
---|---|
date | Thu, 26 Jun 2008 12:41:23 +0000 |
parents | 72ec275e458b |
children | 6441b31b37ac |
comparison
equal
deleted
inserted
replaced
431:9e1e12d1fbc3 | 432:113cf8781bd1 |
---|---|
284 virtual int getRowForFrame(long frame) const | 284 virtual int getRowForFrame(long frame) const |
285 { | 285 { |
286 if (m_rows.empty()) rebuildRowVector(); | 286 if (m_rows.empty()) rebuildRowVector(); |
287 std::vector<long>::iterator i = | 287 std::vector<long>::iterator i = |
288 std::lower_bound(m_rows.begin(), m_rows.end(), frame); | 288 std::lower_bound(m_rows.begin(), m_rows.end(), frame); |
289 return std::distance(m_rows.begin(), i); | 289 int row = std::distance(m_rows.begin(), i); |
290 if (i != m_rows.begin() && (i == m_rows.end() || *i != frame)) { | |
291 --row; | |
292 } | |
293 return row; | |
290 } | 294 } |
291 | 295 |
292 virtual int getColumnCount() const { return 1; } | 296 virtual int getColumnCount() const { return 1; } |
293 virtual QVariant getData(int row, int column, int role) const | 297 virtual QVariant getData(int row, int column, int role) const |
294 { | 298 { |