problem in setting cursor position in readOnly QTextEdit()
hi friends ,
how can i set the cursor position of a readonly QTextEdit() after it get input to the top position ...
like this if the user click a button i am displaying a big paragraph but it showing only the tail position but i want to show the front text first ... i try
but its not working ... i try setCursorPosition(1,1) but it says its not a member function ...
then i tried
Code:
resultTextEdit->cursorForPosition(startPos);
but i dont know how to set it ... please help ...
please help
Re: problem in setting cursor position in readOnly QTextEdit()
Quote:
Originally Posted by
wagmare
how can i set the cursor position of a readonly QTextEdit() after it get input to the top position ...
like this if the user click a button i am displaying a big paragraph but it showing only the tail position but i want to show the front text first ... i try
According to the documentation, QTextEdit::textCursor() returns a copy of the cursor, and changes to that do not affect the QTextEdit. Try to add a QTextEdit::setTextCursor() after the above code to tell the QTextEdit to use the modified cursor.
Re: problem in setting cursor position in readOnly QTextEdit()
Quote:
Originally Posted by
rexi
According to the documentation,
QTextEdit::textCursor() returns a copy of the cursor, and changes to that do not affect the QTextEdit. Try to add a
QTextEdit::setTextCursor() after the above code to tell the QTextEdit to use the modified cursor.
yes it worked , thanks a lot ....
Re: problem in setting cursor position in readOnly QTextEdit()
this below code will work for setting the cursor position in read only mode....
QTextCursor cursor(textEdit->textCursor());
cursor.movePosition(QTextCursor::Start);
textEdit->setTextCursor(cursor);