-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Improved copy/pasting in ExtendedTableWidget #709
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Should it work for BLOBs too? Also, I found a problem, but can't easily reproduce. I had a database which got corrupted because of #674, and had the content
upon copying it and trying to paste in a cell, it pastes Running
and I believe the The same thing happens when trying to copy and paste a non-corrupted BLOB, so maybe we should disable copying (temporarily?) BLOBs. Running
if it is of any help. |
Finally reproduced it using (while learning) the hex editor.
and it will paste |
Excellent @innermous, this looks like a good start to improving the Copy/Paste code. 👍
|
Wait, copying blobs works without my commit? IIRC it just copied "BLOB" text as is. |
f350ff3
to
e69117f
Compare
@innermous, That's what @justinclift said:
|
Yeah, without this PR it just copies the text "BLOB" without the real data. 😉 |
e69117f
to
a514123
Compare
// Copy selected data into inner buffer | ||
int columns = indices.last().column() - indices.first().column() + 1; | ||
while (!indices.isEmpty()) { | ||
QByteArrayList lst; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to need an #include <QByteArrayList>
up top, as Travis is complaining.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never mind, it'll all be fixed.
It's not even ready.
I am astonished though, why my build didn't fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I got it.
They don't have QByteArrayList in Qt4. Another QByteArrayList in SQLiteBrowser code is just typedef.
You still think we shouldn't move to Qt5?
9b9fb51
to
69b6661
Compare
I don't get it. |
69b6661
to
af1e057
Compare
Yeah, we definitely can't move to Qt5 yet. 😦 I'll build our OSX packages for 3.9.0 with Qt4 again for this release. If they work ok for people, and we don't get crash reports (like last time, with 3.8.0), we can probably move to Qt5 only. 😄 |
Looking good. BLOBs are working now, but this still corrupts the cell beneath the target cell. |
af1e057
to
043dee0
Compare
@revolter I don't know how come it got corrupted for you, since multi-blob data is managed via inner buffer. |
Hmmm, I broke the "Apply" button in the Edit Cell with yesterday's change. 😦 I need to fix that first, in order to test some stuff properly. Looking at it now. 😄 |
@innermous, I already explained it, please read again. It's not about copying multiple cells. |
Closed? |
@justinclift I don't know how to implement multilines correctly. |
@innermous, Didn't you say that the multiline problem existed prior to this PR? I think that this adds useful fixed like copying BLOBs correctly. |
Thinking about it, @revolter is correct. This PR fixes some of the existing broken behaviour (binary/image copying internally), without introducing new bugs. It's not a "perfect" solution, but it's better than the code we have. Are you ok with it being merged anyway? 😄 |
Resuming work. |
@innermous Ok. 😄 An idea for this popped into my head last night. For the internal copy-paste operation, would it be possible to treat text type cells as binary? eg:
Detecting external copy to clipboard can probably be done using checksum created for Copy operation, and maybe kept in a class variable. |
} | ||
|
||
// Check whether selection is rectangular | ||
QItemSelection rect(indices.first(), indices.last()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would setting QAbstractItemView::ContiguousSelection
instead, to force a single continuous selection, be better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are not implementing multi-selections copy then you can force rectangular selection.
Moved to google docs format. |
b0da5c8
to
166efc9
Compare
09191a1
to
e607b88
Compare
Feeling sorry for your travis. This is working as a charm now. |
Thanks @innermous, that's awesome! 😄 |
Testing this out now on OSX, it seems pretty good. Copying & pasting BLOB data works properly, as does multi-line text, as does cut-n-paste to external applications. I'm going to cherry-pick this into the 3.9.x branch too. 😉 |
Improved copy/pasting in ExtendedTableWidget
Testing is much appreciated.
NB. return in 199L is workaround, because of mess with keyPressEvent in 226L.