CodeBlock: полный текст без скролла, только иконка 📋
- Убран ScrollView, теперь Rectangle + TextEdit с anchors.fill и implicitHeight: contentHeight+20 — весь код виден целиком, без колёсика - Кнопка копирования: только 📋 (было '📋 Копировать'), при копировании ✓, hover/active Qt.rgba, размер под иконку - TextEdit RichText Wrap, JetBrains Mono 13, selectByMouse, contentHeight
This commit is contained in:
+17
-32
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user