QTextEdit 读取一行 删除一行

 
  
QTextCursor txtcur= ui->textEdit->textCursor();
  txtcur.setPosition(0);
  txtcur.movePosition(QTextCursor::EndOfLine,QTextCursor::KeepAnchor);
  QString qstr= txtcur.selectedText();
  txtcur.movePosition(QTextCursor::Down,QTextCursor::KeepAnchor);
  txtcur.movePosition(QTextCursor::StartOfLine,QTextCursor::KeepAnchor);
  txtcur.removeSelectedText();

你可能感兴趣的:(QT5)