哈哈,QGraphicsTextItem 字间距:void QFont::setLetterSpacing ( SpacingType type, qreal spacing )
行间距,请参考这断代码:
- for (QTextBlock it = doc->begin(); it != doc->end(); it = it.next())
- {
- tc.setPosition(it.position(),QTextCursor::MoveAnchor);
- QTextBlockFormat bfmt = it.blockFormat();
- bfmt.setBottomMargin(mlinespacing);
- tc.setBlockFormat(bfmt);
- this->setTextCursor(tc);
- }
主要是应用 QTextBlock 的 setBottomMargin 这个功能。
希望对你有帮助。