1
0
Fork 0

AbstractTableView: Fixed a bug where asking for tableOffset to be by the end of a section would not give expected result

This commit is contained in:
Herzeh 2015-12-12 00:50:28 +01:00
parent f163bf9368
commit 2e390f7329
1 changed files with 8 additions and 2 deletions

View File

@ -964,10 +964,16 @@ dsint AbstractTableView::getTableOffset()
void AbstractTableView::setTableOffset(dsint val)
{
dsint wMaxOffset = getRowCount() - getViewableRowsCount() + 1;
wMaxOffset = wMaxOffset > 0 ? wMaxOffset : 0;
wMaxOffset = wMaxOffset > 0 ? getRowCount() : 0;
if(val > wMaxOffset)
return;
mTableOffset = val;
// If val is within the last ViewableRows, then set RVA to rowCount - ViewableRows + 1
if(wMaxOffset && val >= (getRowCount() - getViewableRowsCount() + 1))
mTableOffset = (getRowCount() - getViewableRowsCount()) + 1;
else
mTableOffset = val;
emit tableOffsetChanged(val);
#ifdef _WIN64