From b00c4f791f6d5aa4eeaa7d485764d6139df313e2 Mon Sep 17 00:00:00 2001 From: Martin Kleusberg Date: Thu, 5 May 2016 22:57:57 +0200 Subject: [PATCH] plot: Add button to load all data See issue #499. This also fixes a bug introduced in 6784a6a854813bc6577f81c4300d8983abb3cee9 which effectively disabled the partial prefetch mechanism on large tables. --- src/MainWindow.cpp | 17 +++++-- src/MainWindow.h | 1 + src/MainWindow.ui | 108 ++++++++++++++++++++++++++++++--------------- 3 files changed, 87 insertions(+), 39 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index b07fe50a..28a992d9 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -1713,10 +1713,6 @@ void MainWindow::updatePlot(SqliteTableModel *model, bool update) if(model) { - // Make sure all data is loaded before trying to plot anything - while(model->canFetchMore()) - model->fetchMore(); - for(int i = 0; i < model->columnCount(); ++i) { QVariant::Type columntype = guessdatatype(model, i); @@ -2493,3 +2489,16 @@ void MainWindow::browseDataSetDefaultTableEncoding() { browseDataSetTableEncoding(true); } + +void MainWindow::browseDataFetchAllData() +{ + if(m_browseTableModel) + { + // Make sure all data is loaded + while(m_browseTableModel->canFetchMore()) + m_browseTableModel->fetchMore(); + + // Update plot + updatePlot(m_browseTableModel); + } +} diff --git a/src/MainWindow.h b/src/MainWindow.h index ba7711b9..42cff2a2 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -226,6 +226,7 @@ private slots: void showRowidColumn(bool show); void browseDataSetTableEncoding(bool forAllTables = false); void browseDataSetDefaultTableEncoding(); + void browseDataFetchAllData(); }; #endif diff --git a/src/MainWindow.ui b/src/MainWindow.ui index 0316a34f..a5a99b0e 100644 --- a/src/MainWindow.ui +++ b/src/MainWindow.ui @@ -333,7 +333,7 @@ 0 0 - 280 + 468 558 @@ -1255,6 +1255,17 @@ + + + + Load all data. This has only an effect if not all data has been fetched from the table yet due to the partial fetch mechanism. + + + + :/icons/keyword:/icons/keyword + + + @@ -1867,6 +1878,16 @@ spinPragmaWalAutoCheckpoint comboLogSubmittedBy buttonLogClear + mainTab + buttonBegin + buttonEnd + tabSqlAreas + treePlotColumns + comboLineType + comboPointShape + butSavePlot + buttonLoadAllData + treeSchemaDock @@ -1959,8 +1980,8 @@ addRecord() - 443 - 141 + 402 + 143 399 @@ -1975,8 +1996,8 @@ deleteRecord() - 565 - 141 + 506 + 143 399 @@ -1991,8 +2012,8 @@ navigatePrevious() - 74 - 585 + 86 + 539 399 @@ -2007,8 +2028,8 @@ navigateNext() - 168 - 585 + 183 + 539 399 @@ -2023,8 +2044,8 @@ navigateGoto() - 413 - 586 + 365 + 539 399 @@ -2039,8 +2060,8 @@ navigateGoto() - 565 - 586 + 506 + 538 399 @@ -2295,8 +2316,8 @@ createTreeContextMenu(QPoint) - 101 - 125 + 111 + 261 399 @@ -2343,8 +2364,8 @@ loadPragmas() - 101 - 125 + 111 + 540 -1 @@ -2359,8 +2380,8 @@ savePragmas() - 101 - 125 + 111 + 540 802 @@ -2379,8 +2400,8 @@ 126 - 691 - 163 + 632 + 173 @@ -2395,8 +2416,8 @@ 126 - 990 - 240 + 1028 + 230 @@ -2407,12 +2428,12 @@ setCurrentIndex(int) - 872 - 126 + 772 + 135 - 987 - 240 + 1028 + 230 @@ -2439,8 +2460,8 @@ closeSqlTab(int) - 81 - 125 + 91 + 259 -1 @@ -2663,8 +2684,8 @@ navigateEnd() - 189 - 573 + 223 + 539 499 @@ -2679,8 +2700,8 @@ navigateBegin() - 69 - 140 + 50 + 539 499 @@ -2727,8 +2748,8 @@ jumpToRow(QString,QString,QByteArray) - 60 - 105 + 70 + 242 518 @@ -2800,6 +2821,22 @@ + + buttonLoadAllData + clicked() + MainWindow + browseDataFetchAllData() + + + 1003 + 389 + + + 1005 + 412 + + + fileOpen() @@ -2860,5 +2897,6 @@ showRowidColumn(bool) browseDataSetTableEncoding() browseDataSetDefaultTableEncoding() + browseDataFetchAllData()