get selected single cell in QTextTable?
-
@mondayboy I'm not familiar with this, but I took a look at the doc and it seems to be consistent with the behaviour you describe.
Could you use this in the single cell case:
QTextTableCell QTextTable::cellAt(const QTextCursor &cursor) const
?
-
@mondayboy
Your question is unclear. What Qt function is theselectedTableCells()
which you say you know to use? If whatever it is returns all selected cells, and the user only selects a single cell, then that will be the first and only element in the returned list. -
@JonB said in get selected single cell in QTextTable?:
selectedTableCells
hi, selectedTableCells() is a public funtion of QTextCursor Class. When my selection spans over table cells, it works, but when I just select one single cell, it returns (-1,-1,-1,-1), not row index and column index of the cell.
-
@mondayboy I'm not familiar with this, but I took a look at the doc and it seems to be consistent with the behaviour you describe.
Could you use this in the single cell case:
QTextTableCell QTextTable::cellAt(const QTextCursor &cursor) const
?
-
@mondayboy
Thanks. Interesting. Googlingqt selectedtablecells
does not supply any hit for such a function, underQTextCursor
or anywhere else. I rely on this to locate functions, it has let me down this time!The documentation is a bit unclear, but it looks like it only returns anything if the selection spans over multiple table cells, which is a bit weird.
I see @Bob64 has posted a suggestion while I was typing, try that.
-
-