设置QTextEdit的行高和行间距

来源:互联网 发布:linux的认识与理解 编辑:程序博客网 时间:2024/06/17 14:25

   设置QTextEdit的行高

    QTextCursor textCursor = ui->textEdit->textCursor();    QTextBlockFormat textBlockFormat;    textBlockFormat.setLineHeight(40, QTextBlockFormat::FixedHeight);//设置固定行高    textCursor.setBlockFormat(textBlockFormat);    ui->textEdit->setTextCursor(textCursor);

  设置QTextEdit的行间距

    QTextCursor textCursor = ui->textEdit->textCursor();    QTextBlockFormat textBlockFormat;    textBlockFormat.setBottomMargin(10);    textCursor.setBlockFormat(textBlockFormat);    ui->textEdit->setTextCursor(textCursor);