From 71cf0531fea42cfcb9891cd8ff21be5eaddd6a09 Mon Sep 17 00:00:00 2001 From: yunfzhan Date: Tue, 2 Dec 2014 18:23:52 -0800 Subject: [PATCH] Add two buttons to navigate to the head and the tail. --- src/MainWindow.cpp | 12 ++++ src/MainWindow.h | 2 + src/MainWindow.ui | 144 +++++++++++++++++++++++++++++++++------------ 3 files changed, 119 insertions(+), 39 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index a506dfa0..8a6e7e78 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -534,6 +534,16 @@ void MainWindow::navigateNext() selectTableLine(curRow); } +void MainWindow::navigateBegin() +{ + selectTableLine(0); +} + +void MainWindow::navigateEnd() +{ + selectTableLine(m_browseTableModel->totalRowCount()-1); +} + void MainWindow::navigateGoto() { @@ -1088,6 +1098,8 @@ void MainWindow::activateFields(bool enable) ui->editCreateIndexAction->setEnabled(enable); ui->buttonNext->setEnabled(enable); ui->buttonPrevious->setEnabled(enable); + ui->buttonBegin->setEnabled(enable); + ui->buttonEnd->setEnabled(enable); ui->scrollAreaWidgetContents->setEnabled(enable); ui->buttonBoxPragmas->setEnabled(enable); ui->buttonGoto->setEnabled(enable); diff --git a/src/MainWindow.h b/src/MainWindow.h index aba0f603..089c84c8 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -129,6 +129,8 @@ private slots: void selectTableLine( int lineToSelect ); void navigatePrevious(); void navigateNext(); + void navigateBegin(); + void navigateEnd(); void navigateGoto(); void setRecordsetLabel(); void createTable(); diff --git a/src/MainWindow.ui b/src/MainWindow.ui index 584c9b6d..0878f6fc 100644 --- a/src/MainWindow.ui +++ b/src/MainWindow.ui @@ -181,6 +181,22 @@ + + + + false + + + <html><head/><body><p>Scroll to the beginning</p></body></html> + + + <html><head/><body><p>Clicking this button navigates to the beginning in the table view above.</p></body></html> + + + << + + + @@ -220,6 +236,22 @@ + + + + false + + + Scroll to the end + + + <html><head/><body><p>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Clicking this button navigates up to the end in the table view above.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</p></body></html> + + + >> + + + @@ -278,8 +310,8 @@ 0 0 - 575 - 458 + 311 + 531 @@ -764,7 +796,7 @@ 0 0 1000 - 19 + 25 @@ -1683,8 +1715,8 @@ populateTable(QString) - 59 - 82 + 118 + 141 399 @@ -1699,8 +1731,8 @@ addRecord() - 584 - 82 + 443 + 141 399 @@ -1715,8 +1747,8 @@ deleteRecord() - 687 - 82 + 565 + 141 399 @@ -1731,8 +1763,8 @@ navigatePrevious() - 27 - 380 + 74 + 585 399 @@ -1747,8 +1779,8 @@ navigateNext() - 128 - 380 + 168 + 585 399 @@ -1763,8 +1795,8 @@ navigateGoto() - 493 - 380 + 413 + 586 399 @@ -1779,8 +1811,8 @@ navigateGoto() - 790 - 379 + 565 + 586 399 @@ -1795,8 +1827,8 @@ browseRefresh() - 265 - 103 + 245 + 139 399 @@ -2035,8 +2067,8 @@ createTreeContextMenu(QPoint) - 399 - 341 + 101 + 125 399 @@ -2083,8 +2115,8 @@ loadPragmas() - 251 - 381 + 101 + 125 -1 @@ -2099,8 +2131,8 @@ savePragmas() - 364 - 381 + 101 + 125 802 @@ -2115,12 +2147,12 @@ clear() - 794 - 441 + 989 + 126 - 103 - 476 + 691 + 163 @@ -2131,12 +2163,12 @@ clear() - 794 - 441 + 989 + 126 - 611 - 576 + 990 + 240 @@ -2147,12 +2179,12 @@ setCurrentIndex(int) - 258 - 441 + 872 + 126 - 399 - 492 + 987 + 240 @@ -2179,8 +2211,8 @@ closeSqlTab(int) - 48 - 90 + 81 + 125 -1 @@ -2396,6 +2428,38 @@ + + buttonEnd + clicked() + MainWindow + navigateEnd() + + + 189 + 573 + + + 499 + 314 + + + + + buttonBegin + clicked() + MainWindow + navigateBegin() + + + 69 + 140 + + + 499 + 314 + + + fileOpen() @@ -2405,6 +2469,8 @@ deleteRecord() navigatePrevious() navigateNext() + navigateBegin() + navigateEnd() navigateGoto() browseFind(bool) browseRefresh()