Qt入门 - QTextEdit
时间:2014-07-22 23:07:54
收藏:0
阅读:2395
QTextEdit *textedit = new QTextEdit();
获取文本框内容:QString qstring = textedit->toPlainText();
设置文本框内容:textedit->setPlainText(qstring);
自动跳到最后一行:
QTextCursor tc =
textEdit->textCursor();
tc.movePosition(QTextCursor::End);
textEdit->setTextCursor(tc);
自动跳到某一行:
QTextCursor tc = textCursor();
int position = document()->findBlockByNumber ( line-1 ).position();
tc.setPosition(position,QTextCursor::MoveAnchor);
setTextCursor( tc );
设置最大行数:textEdit->document()->setMaximumBlockCount(linecnt);
获取行数:textEdit->document()->lineCount();
评论(0)