mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 19:11:39 -06:00
Add basic function for cancelling queries
This doesn't do all the work yet and isn't called anywhere. So don't expect this to do anything useful.
This commit is contained in:
@@ -920,3 +920,18 @@ void SqliteTableModel::waitForFetchingFinished()
|
||||
if(m_futureFetch.isRunning())
|
||||
m_futureFetch.waitForFinished();
|
||||
}
|
||||
|
||||
void SqliteTableModel::cancelQuery()
|
||||
{
|
||||
if(m_rowCount.isRunning())
|
||||
{
|
||||
m_rowCount.cancel();
|
||||
m_rowCount = QtConcurrent::run([=]() {
|
||||
// Make sure we report 0 rows if anybody asks
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
|
||||
if(m_futureFetch.isRunning())
|
||||
m_futureFetch.cancel();
|
||||
}
|
||||
|
||||
@@ -75,6 +75,10 @@ public:
|
||||
public slots:
|
||||
void updateFilter(int column, const QString& value);
|
||||
|
||||
// This cancels the execution of the current query. It can't guarantee that the query is stopped immediately or after returning but it should
|
||||
// stop soon afterwards. If some data has already been loaded into the model, that data is not deleted
|
||||
void cancelQuery();
|
||||
|
||||
signals:
|
||||
void finishedFetch();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user