I am trying to select a part of a table with text that is in a QTextBrowser (QTextEdit acts the same in this matter). I've made the table using html tags and seting append();
I can select all the text with:
cursor.movePosition(QTextCursor::End, QTextCursor::MoveAnchor);
// cursor.movePosition(QTextCursor::StartOfLine, QTextCursor::MoveAnchor); //does not work
cursor.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor);
cursor.movePosition(QTextCursor::End, QTextCursor::KeepAnchor);
cursor.select(QTextCursor::Document);
But I cannot select one cell (or even one row). I've tried QTextCursor::NextCell and QTextCursor::NextRow as there is written in the Qt reference manual.
I've managed to select the whole row with:
cursor.movePosition(QTextCursor::End);
cursor.movePosition(QTextCursor::PreviousBlock, QTextCursor::MoveAnchor);
cursor.movePosition(QTextCursor::NextBlock, QTextCursor::KeepAnchor);
cursor.select(QTextCursor::BlockUnderCursor);
I am still unable to select only one cell. I've tried moving one cell in a row and then using cursor.selectedText(); but with no succes.