From 6d2fda878c266c6d531f277d00dfccbaa774783e Mon Sep 17 00:00:00 2001 From: James Graham Date: Sat, 28 Feb 2026 17:06:30 +0000 Subject: [PATCH] Fix the Timeline Feezes. This was caused whe TextComponent was changed from a TextEdit to a TextArea for the rich chat bar. This causes freezing for ..... reasons. Changin it back fixes the freezes. The upshot of this is we now have to implement placeholder text ourselves. So I copied how it is done in TestArea in QQC2 desktop style with some minor logic changes for us. --- src/messagecontent/TextComponent.qml | 36 ++++++++++++++++++---------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/src/messagecontent/TextComponent.qml b/src/messagecontent/TextComponent.qml index 5818f6f3b..2935f2728 100644 --- a/src/messagecontent/TextComponent.qml +++ b/src/messagecontent/TextComponent.qml @@ -13,7 +13,7 @@ import org.kde.neochat /** * @brief A component to show rich text from a message. */ -QQC2.TextArea { +TextEdit { id: root /** @@ -106,15 +106,6 @@ QQC2.TextArea { readOnly: !root.editable wrapMode: Text.Wrap textFormat: Text.RichText - placeholderText: if (!editable || index !== (Message.contentModel?.hasAttachment ? 1 : 0)) { - return ""; - } else if (Message.contentModel?.hasAttachment) { - i18nc("@placeholder", "Set an attachment caption…") - } else if (Message.room?.usesEncryption) { - i18nc("@placeholder", "Send an encrypted message…") - } else { - i18nc("@placeholder", "Send a message…") - } onLinkActivated: link => { if (!root.editable) { @@ -129,6 +120,29 @@ QQC2.TextArea { Component.onCompleted: manageDefaultMenus() + QQC2.Label { + id: placeholder + x: root.leftPadding + y: root.topPadding + width: root.width - (root.leftPadding + root.rightPadding) + height: root.height - (root.topPadding + root.bottomPadding) + + text: if (root.Message.contentModel?.hasAttachment) { + i18nc("@placeholder", "Set an attachment caption…") + } else if (root.Message.room?.usesEncryption) { + i18nc("@placeholder", "Send an encrypted message…") + } else { + i18nc("@placeholder", "Send a message…") + } + font: root.font + color: Kirigami.Theme.disabledTextColor + horizontalAlignment: root.horizontalAlignment + verticalAlignment: root.verticalAlignment + visible: root.editable && root.index === (root.Message.contentModel?.hasAttachment ? 1 : 0) && (root.Message.contentModel?.rowCount() ?? 0) <= 1 && !root.length && !root.preeditText && (!root.activeFocus || root.horizontalAlignment !== Qt.AlignHCenter) + elide: Text.ElideRight + wrapMode: Text.WordWrap + } + HoverHandler { cursorShape: root.hoveredLink || (!(root.componentAttributes?.spoilerRevealed ?? false) && root.hasSpoiler) ? Qt.PointingHandCursor : Qt.IBeamCursor } @@ -169,6 +183,4 @@ QQC2.TextArea { } } } - - background: null }