I want to toggle the algebraic sign (e.g. 100 (press togglebutton) -100 (press togglebutton again) 100 ... and so on) on and off.
The Problem is that the Text Cursor in the PlainTextEdit (Read only) jumps to the beginning every time i click that button.

So the question is, how to set the (invisible) Text Cursor to the end.
Thanks 4 your help!

Here is the important part of the code. I tried serveral things (commented out by //), but without success.

---

void cal::on_algebraicsign_clicked()
{
if (aspositive==true && var!="")
{
contenttextbox = ui->textbox->toPlainText();
contenttextbox = contenttextbox.left(contenttextbox.length()-var.length());
var = "-" + var;
ui->textbox->setPlainText(contenttextbox+var);
//QPlainTextEdit::keyPressEvent(0)
aspositive=false;
}
else if (var!="")
{
contenttextbox = ui->textbox->toPlainText();
contenttextbox = contenttextbox.left(contenttextbox.length()-var.length());
var = var.right(var.length()-1);
ui->textbox->setPlainText(contenttextbox+var);
//ui->textbox->setTextCursor(contenttextbox.length()+var.length( ));
//or QPlainTextEdit::moveCursor(QTextCursor.End);

aspositive=true;
}
}

---