How can i get the next and previous character content from cursor posion in a QTextEdit?
How can i get the next and previous character content from cursor posion in a QTextEdit?
try
QTextCursor :: position ()
Should be damm easy.
Qt Code:
textEdit->toPlainText().at(position-1); textEdit->toPlainText().at(position+1);To copy to clipboard, switch view to plain text mode
Last edited by yogeshgokul; 15th July 2009 at 11:14.
wagmare (15th July 2009)
after selecting the character or by default position ..?
"Behind every great fortune lies a crime" - Balzac
but how can we get the char the QTextCursor currently positioned ..
ex:
hell|o world
think "|" as cursor position .. it is in middle of "l" and "o" .. so how can i get that two char or either of it ...
the position is dynamic at run time .. and the position is not hard coded value ..
any way to implement ..
and u answered it .. thank you very much ...
"Behind every great fortune lies a crime" - Balzac
Qt Code:
int pos = TextEdit->textCursor().position();To copy to clipboard, switch view to plain text mode
Bookmarks