mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
Don't copy data from hidden columns to clipboard
Copying data from hidden columns is not only confusing but does also break some common use cases. This commit makes sure that we're not copying any data from hidden columns. That means the only way to get the old behaviour now is to unhide all columns, including the rowid column. See issue #1094.
This commit is contained in:
@@ -154,6 +154,17 @@ void ExtendedTableWidget::copy(const bool withHeaders)
|
||||
{
|
||||
QModelIndexList indices = selectionModel()->selectedIndexes();
|
||||
|
||||
// Remove all indices from hidden columns, because if we don't we might copy data from hidden columns as well which is very
|
||||
// unintuitive; especially copying the rowid column when selecting all columns of a table is a problem because pasting the data
|
||||
// won't work as expected.
|
||||
for(int i=indices.size()-1;i>=0;)
|
||||
{
|
||||
if(isColumnHidden(indices.at(i).column()))
|
||||
indices.removeAt(i);
|
||||
else
|
||||
i--;
|
||||
}
|
||||
|
||||
// Abort if there's nothing to copy
|
||||
if (indices.isEmpty())
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user