mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 19:11:39 -06:00
Load all data when select all is requested
selectAll is overridden so all data is actually selected. Warn and ask user as this may take some time and consume lots of memory (when the table is big). See issue #1373
This commit is contained in:
@@ -914,6 +914,31 @@ void ExtendedTableWidget::selectTableLines(int firstLine, int count)
|
||||
selectionModel()->select(QItemSelection(topLeft, bottomRight), QItemSelectionModel::Select | QItemSelectionModel::Rows);
|
||||
}
|
||||
|
||||
void ExtendedTableWidget::selectAll()
|
||||
{
|
||||
SqliteTableModel* m = qobject_cast<SqliteTableModel*>(model());
|
||||
|
||||
// Fetch all the data if needed and user accepts, then call parent's selectAll()
|
||||
|
||||
QMessageBox::StandardButton answer = QMessageBox::Yes;
|
||||
|
||||
// If we can fetch more data, ask user if they are sure about it.
|
||||
if (!m->isCacheComplete()) {
|
||||
|
||||
answer = QMessageBox::question(this, QApplication::applicationName(),
|
||||
tr("<p>Not all data has been loaded. <b>Do you want to load all data before selecting all the rows?</b><p>"
|
||||
"<p>Answering <b>No</b> means that no more data will be loaded and the selection will not be performed.<br/>"
|
||||
"Answering <b>Yes</b> might take some time while the data is loaded but the selection will be complete.</p>"
|
||||
"Warning: Loading all the data might require a great amount of memory for big tables."),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
if (answer == QMessageBox::Yes)
|
||||
m->completeCache();
|
||||
}
|
||||
if (answer == QMessageBox::Yes)
|
||||
QTableView::selectAll();
|
||||
}
|
||||
|
||||
void ExtendedTableWidget::openPrintDialog()
|
||||
{
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
|
||||
@@ -56,6 +56,7 @@ public slots:
|
||||
void reloadSettings();
|
||||
void selectTableLine(int lineToSelect);
|
||||
void selectTableLines(int firstLine, int count);
|
||||
void selectAll();
|
||||
void openPrintDialog();
|
||||
|
||||
signals:
|
||||
|
||||
Reference in New Issue
Block a user