From 7e494afbe4d11452bf0dc89cb68214fae91ce2eb Mon Sep 17 00:00:00 2001 From: grendervill Date: Tue, 1 Sep 2026 21:56:29 +0300 Subject: [PATCH] =?UTF-8?q?CodeBlock:=20=D0=BF=D0=BE=D0=BB=D0=BD=D1=8B?= =?UTF-8?q?=D0=B9=20=D1=82=D0=B5=D0=BA=D1=81=D1=82=20=D0=B1=D0=B5=D0=B7=20?= =?UTF-8?q?=D1=81=D0=BA=D1=80=D0=BE=D0=BB=D0=BB=D0=B0,=20=D1=82=D0=BE?= =?UTF-8?q?=D0=BB=D1=8C=D0=BA=D0=BE=20=D0=B8=D0=BA=D0=BE=D0=BD=D0=BA=D0=B0?= =?UTF-8?q?=20=F0=9F=93=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Убран ScrollView, теперь Rectangle + TextEdit с anchors.fill и implicitHeight: contentHeight+20 — весь код виден целиком, без колёсика - Кнопка копирования: только 📋 (было '📋 Копировать'), при копировании ✓, hover/active Qt.rgba, размер под иконку - TextEdit RichText Wrap, JetBrains Mono 13, selectByMouse, contentHeight --- qml/panels/CodeBlock.qml | 49 ++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 32 deletions(-) diff --git a/qml/panels/CodeBlock.qml b/qml/panels/CodeBlock.qml index 0ddf0c2..a2acadb 100644 --- a/qml/panels/CodeBlock.qml +++ b/qml/panels/CodeBlock.qml @@ -73,9 +73,9 @@ Rectangle { Label { id: copyLabel anchors.centerIn: parent - text: copyButton.copied ? "✓ Скопировано" : "📋 Копировать" + text: copyButton.copied ? "✓" : "📋" color: copyButton.copied ? "#6ab2f6" : "#ffffff" - font.pixelSize: 11 + font.pixelSize: 13 font.family: "-apple-system, sans-serif" } @@ -95,42 +95,27 @@ Rectangle { } } - // Code area - like real editor + // Code area - как в редакторе, но без скролла — весь текст виден целиком Rectangle { width: parent.width color: Qt.rgba(0,0,0,0.22) radius: 8 - // height based on content - use contentHeight for accurate - implicitHeight: Math.max(40, codeText.contentHeight + 20) + implicitHeight: codeText.contentHeight + 20 - ScrollView { - id: codeScroll + TextEdit { + id: codeText anchors.fill: parent - anchors.margins: 8 - clip: true - ScrollBar.horizontal.policy: ScrollBar.AsNeeded - ScrollBar.vertical.policy: ScrollBar.AsNeeded - - TextArea { - id: codeText - width: codeScroll.availableWidth - readOnly: true - selectByMouse: true - textFormat: Text.RichText - wrapMode: Text.Wrap - color: "#ffffff" - selectionColor: "#3a6ea5" - selectedTextColor: "#ffffff" - font.family: "JetBrains Mono, Fira Code, Menlo, Consolas, monospace" - font.pixelSize: 13 - tabStopDistance: 32 - text: root.highlightedText.length > 0 ? root.highlightedText : root.code - background: Rectangle { color: "transparent" } - // Ensure contentHeight is updated - onTextChanged: { - // Force update - } - } + anchors.margins: 10 + text: root.highlightedText.length > 0 ? root.highlightedText : root.code + textFormat: TextEdit.RichText + wrapMode: TextEdit.Wrap + readOnly: true + selectByMouse: true + color: "#ffffff" + selectionColor: "#3a6ea5" + selectedTextColor: "#ffffff" + font.family: "JetBrains Mono, Fira Code, Menlo, Consolas, monospace" + font.pixelSize: 13 } } }