QTextEdit questions
-
-
Is it possible to ask the text edit control to use a slightly tighter line spacing?
-
Is there any simple way to append text without adding a new line?
Thanks, David
@Perdrix said in QTextEdit questions:
Is it possible to ask the text edit control to use a slightly tighter line spacing?
Many examples from Google
qtextedit set line spacing, such as https://stackoverflow.com/questions/10250533/set-line-spacing-in-qtextedit ?Is there any simple way to append text without adding a new line?
Since
QTextEdit::append()"Appends a new paragraph" I would guess you need to use aQTextCursorto do something like insert text at the end of the existing last paragraph? -
-
@Perdrix said in QTextEdit questions:
Is it possible to ask the text edit control to use a slightly tighter line spacing?
Many examples from Google
qtextedit set line spacing, such as https://stackoverflow.com/questions/10250533/set-line-spacing-in-qtextedit ?Is there any simple way to append text without adding a new line?
Since
QTextEdit::append()"Appends a new paragraph" I would guess you need to use aQTextCursorto do something like insert text at the end of the existing last paragraph?@JonB Thanks for the pointer
Here's what I did for the spacing etc.
// // Before any messages are written to the log, reduce the line spacing a bit // and reduce the font size by one // QTextBlockFormat bf = messageLog->textCursor().blockFormat(); bf.setLineHeight(85, QTextBlockFormat::ProportionalHeight); messageLog->textCursor().setBlockFormat(bf); QFont font{ messageLog->currentFont() }; font.setPointSize(font.pointSize() - 1); font.setWeight(QFont::Medium); messageLog->setFont(font);and for appending:
messageLog->moveCursor(QTextCursor::End); messageLog->insertPlainText(message);