Implement page-wise scrolling in Browse Data tab

Don't scroll by 100 records when using the scroll buttons but scroll by
one screen page.

See issue #232.
This commit is contained in:
Martin Kleusberg
2017-05-08 12:06:56 +02:00
parent 06398be884
commit ef0ae8d549
2 changed files with 4 additions and 4 deletions

View File

@@ -19,6 +19,7 @@ public:
public:
QSet<int> selectedCols();
int numVisibleRows();
public slots:
void reloadSettings();
@@ -30,7 +31,6 @@ signals:
private:
void copy();
void paste();
int numVisibleRows();
typedef QList<QByteArray> QByteArrayList;
QList<QByteArrayList> m_buffer;

View File

@@ -634,14 +634,14 @@ void MainWindow::selectTableLine(int lineToSelect)
// Select it
ui->dataTable->clearSelection();
ui->dataTable->selectRow(lineToSelect);
ui->dataTable->scrollTo(ui->dataTable->currentIndex());
ui->dataTable->scrollTo(ui->dataTable->currentIndex(), QAbstractItemView::PositionAtTop);
QApplication::restoreOverrideCursor();
}
void MainWindow::navigatePrevious()
{
int curRow = ui->dataTable->currentIndex().row();
curRow -= 100;
curRow -= ui->dataTable->numVisibleRows() - 1;
if(curRow < 0)
curRow = 0;
selectTableLine(curRow);
@@ -651,7 +651,7 @@ void MainWindow::navigatePrevious()
void MainWindow::navigateNext()
{
int curRow = ui->dataTable->currentIndex().row();
curRow += 100;
curRow += ui->dataTable->numVisibleRows() - 1;
if(curRow >= m_browseTableModel->totalRowCount())
curRow = m_browseTableModel->totalRowCount() - 1;
selectTableLine(curRow);