How to copy from Excel and paste to QTableView
Hello everyone,
I already manage to copy rows and column data from QTableView to Excel. Using QApplication::clipboard() and QMimeData classes. I use ctrl +c to call the method to copy to clipboard and ctrl +v to paste. This last one is the default shortcut.
But I am stuck now :eek: , I cant find out the way to do it the other way around. I use ctrl +c from excel to copy to clipboard but ctrl +v doesnt do anything to QTableView.
I though it could be a problem related to flags. I set setAcceptDrops(true), then I thought about setDragDropMode(QAbstractItemView::DropOnly) ( I dont want drag enable because i use my own types for the table items and It crashes if I only drag and drop items.
HElP with hints. Can I find and example anywhere?
Thanks in advance :)
Re: How to copy from Excel and paste to QTableView
Check out the C++ GUI Programming with Qt4 book. Google has it scanned in here. That book pretty much teaches how to create a spreadsheet app.
Re: How to copy from Excel and paste to QTableView
Thanks fnmblot :)
This hint was very helpful! I found what I was looking for...
Re: How to copy from Excel and paste to QTableView
Can you please tell me how do you paste from excel to qt ?
Re: How to copy from Excel and paste to QTableView
Can you please tell me how do you paste from excel to qt ? ( sample code will help me )
Re: How to copy from Excel and paste to QTableView
You need to see how excel save its selection to the clipboard, then handle it.
If you want Qt -> excel, just use \t for column and \n for line, excel will understand it.