Is it possible to make QTableWidget copyable?
-
Hi,
I have a basic question, is it possible to make
QTableWidget
cells copyable?For ex, I wonder if there is a feature to select cells on
QTableWidget
and copy contents into a spreadsheet.@viniltc
In a word: you cannot/would not want to copyQTableWidget
cells (with all their layout etc.), but you can indeed certainly copy the data in the cells easily. Just iterate the table rows/columns outputtingdata(index(row, column))
e.g. to a CSV file. -
Hi,
Do you mean doing Ctrl+C from your QTableWidget and Ctrl+V in Excel ?
-
Can you be more precise ?
"Can't" can mean several different things like:
- can't select multiple cells
- can't paste
etc.
-
I would assume then that QAbstractItemView::selectionMode() is QAbstractItemView::SingleSelection
-
Can you be more precise ?
"Can't" can mean several different things like:
- can't select multiple cells
- can't paste
etc.
-
It's up to you to implement a contextual menu for that. See customContextMenuRequested.