From 736f319044c5689237a015a97447b6f031691932 Mon Sep 17 00:00:00 2001 From: in1tiate <32779090+in1tiate@users.noreply.github.com> Date: Sun, 16 Jun 2024 21:16:56 -0500 Subject: [PATCH 1/2] Explicitly set sane line spacing --- src/courtroom.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index c2c34219c..0a70cf6bf 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3299,6 +3299,14 @@ void Courtroom::initialize_chatbox() ui_vp_message->move(ui_vp_message->x() + ui_vp_chatbox->x(), ui_vp_message->y() + ui_vp_chatbox->y()); ui_vp_message->setTextInteractionFlags(Qt::NoTextInteraction); + // For some reason, line spacing is done incorrectly unless we set it here. + QTextCursor textCursor = ui_vp_message->textCursor(); + QTextBlockFormat *newFormat = new QTextBlockFormat(); + textCursor.clearSelection(); + textCursor.select(QTextCursor::Document); + newFormat->setLineHeight(100, QTextBlockFormat::ProportionalHeight); + textCursor.setBlockFormat(*newFormat); + if (ui_vp_showname->text().trimmed().isEmpty()) // Whitespace showname { ui_vp_chatbox->setImage("chatblank", p_misc); From b3c4a2e3ade26d1d635b177369268234c6e152e0 Mon Sep 17 00:00:00 2001 From: Salanto <62221668+Salanto@users.noreply.github.com> Date: Tue, 18 Jun 2024 09:56:29 +0200 Subject: [PATCH 2/2] Update naming to reflect setting set by Format Address memory leak --- src/courtroom.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 0a70cf6bf..42db26fee 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3301,11 +3301,11 @@ void Courtroom::initialize_chatbox() // For some reason, line spacing is done incorrectly unless we set it here. QTextCursor textCursor = ui_vp_message->textCursor(); - QTextBlockFormat *newFormat = new QTextBlockFormat(); + QTextBlockFormat linespacingFormat = QTextBlockFormat(); textCursor.clearSelection(); textCursor.select(QTextCursor::Document); - newFormat->setLineHeight(100, QTextBlockFormat::ProportionalHeight); - textCursor.setBlockFormat(*newFormat); + linespacingFormat.setLineHeight(100, QTextBlockFormat::ProportionalHeight); + textCursor.setBlockFormat(linespacingFormat); if (ui_vp_showname->text().trimmed().isEmpty()) // Whitespace showname {