Исправлен белый экран предпросмотра: CodeBlock отдельный компонент

- CodeBlock.qml: Qt.rgba вместо "rgba(...)", убран lineHeight, contentHeight для ScrollView, width via availableWidth
- MarkdownView.qml: ListModel с полными ролями (codeText/highlightedText), delegate без required model, Column anchors.top/left/right, parseBlocks сохраняет codeBlocks
- MdParser: parseBlocks с QRegularExpression и сохранением codeBlocks, forceDark highlight
- mdparser_test: проверка parseBlocks 3 блока
- ctest 21/21, offscreen/cocoa RUNNING OK, Flora.app 180М
This commit is contained in:
2026-09-01 21:47:40 +03:00
parent b3fa778d88
commit bfd955a3f9
4 changed files with 53 additions and 13 deletions
+8 -2
View File
@@ -100,10 +100,11 @@ Rectangle {
width: parent.width
color: Qt.rgba(0,0,0,0.22)
radius: 8
// height based on content
implicitHeight: codeText.implicitHeight + 20
// height based on content - use contentHeight for accurate
implicitHeight: Math.max(40, codeText.contentHeight + 20)
ScrollView {
id: codeScroll
anchors.fill: parent
anchors.margins: 8
clip: true
@@ -112,6 +113,7 @@ Rectangle {
TextArea {
id: codeText
width: codeScroll.availableWidth
readOnly: true
selectByMouse: true
textFormat: Text.RichText
@@ -124,6 +126,10 @@ Rectangle {
tabStopDistance: 32
text: root.highlightedText.length > 0 ? root.highlightedText : root.code
background: Rectangle { color: "transparent" }
// Ensure contentHeight is updated
onTextChanged: {
// Force update
}
}
}
}