Skip to content

Commit 9475f31

Browse files
committed
Paste non-text data as BLOB
Ideally, if we are copying internally, we should preserve the data type of the original cell(s), but with this workaround, at least we are not inserting binary data as if it were text. See related issue #3307
1 parent c2a4861 commit 9475f31

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/ExtendedTableWidget.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "Settings.h"
66
#include "sqlitedb.h"
77
#include "CondFormat.h"
8+
#include "Data.h"
89

910
#include <QApplication>
1011
#include <QClipboard>
@@ -739,7 +740,7 @@ void ExtendedTableWidget::paste()
739740
img.save(&buffer, "PNG"); // We're always converting the image format to PNG here. TODO: Is that correct?
740741
buffer.close();
741742

742-
m->setData(indices.first(), ba);
743+
m->setTypedData(indices.first(), /* isBlob = */ !isTextOnly(ba), ba);
743744
return;
744745
}
745746

@@ -785,7 +786,7 @@ void ExtendedTableWidget::paste()
785786
for(int row=firstRow;row<firstRow+selectedRows;row++)
786787
{
787788
for(int column=firstColumn;column<firstColumn+selectedColumns;column++)
788-
m->setData(m->index(row, column), bArrdata);
789+
m->setTypedData(m->index(row, column), !isTextOnly(bArrdata), bArrdata);
789790
}
790791
return;
791792
}

0 commit comments

Comments
 (0)