plot: Fix fetch all data button for plots based on query data

The fetch all data button in the plot area would load all data as if the
Browse Data tab was active even though the plot is based on a SQL query
in the EXecute SQL tab. That would lead to non-sensical results. With
this commit the button always load the correct data.

See issue #820.
This commit is contained in:
Martin Kleusberg
2016-11-04 18:17:26 +01:00
parent f3dcf5a0c8
commit 70a44971be

View File

@@ -2716,7 +2716,7 @@ void MainWindow::browseDataSetDefaultTableEncoding()
void MainWindow::browseDataFetchAllData()
{
if(m_browseTableModel)
if(m_currentPlotModel)
{
// Show progress dialog because fetching all data might take some time
QProgressDialog progress(tr("Fetching all data..."),
@@ -2726,19 +2726,19 @@ void MainWindow::browseDataFetchAllData()
qApp->processEvents();
// Make sure all data is loaded
while(m_browseTableModel->canFetchMore())
while(m_currentPlotModel->canFetchMore())
{
// Fetch the next bunch of data
m_browseTableModel->fetchMore();
m_currentPlotModel->fetchMore();
// Update the progress dialog and stop loading data when the cancel button was pressed
progress.setValue(m_browseTableModel->rowCount());
progress.setValue(m_currentPlotModel->rowCount());
qApp->processEvents();
if(progress.wasCanceled())
break;
}
// Update plot
updatePlot(m_browseTableModel);
updatePlot(m_currentPlotModel);
}
}