Add unquoted single cell copy functionality

If a single cell is copied, its contents are not quoted now. This was
working in 3.8.0.

See #789
This commit is contained in:
Iulian Onofrei
2016-09-30 15:24:18 +03:00
parent 4c8e2a3517
commit 8c510ff4e4

View File

@@ -86,12 +86,17 @@ void ExtendedTableWidget::copy()
SqliteTableModel* m = qobject_cast<SqliteTableModel*>(model());
// If single image cell selected - copy it to clipboard
// If a single cell is selected, copy it to clipboard
if (indices.size() == 1) {
QImage img;
if (img.loadFromData(m->data(indices.first(), Qt::EditRole).toByteArray())) {
QVariant data = m->data(indices.first(), Qt::EditRole);
if (img.loadFromData(data.toByteArray())) { // If it's an image
qApp->clipboard()->setImage(img);
return;
} else {
qApp->clipboard()->setText(data.toString());
return;
}
}