From b2efe6ea27dd1e363c9848bbd27fc8d71725854b Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Mon, 5 Oct 2026 09:49:05 +0200 Subject: [PATCH] Fix body editor under the Breeze style MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The body editor was a TextArea with a custom background inside a ScrollView. Under the Breeze QML style that raised "Unable to assign TextArea to QQuickTextInput" (Breeze's TextArea.qml rejects a custom background in that nesting). Switch to the Qt-recommended idiom: a Flickable with TextArea.flickable: TextArea { background: null }, wrapped in a plain Rectangle that provides the border/background. Keeps monospace wrapping, seed-on-open, Ctrl+Enter save and Esc cancel; adds a vertical ScrollBar. GUI builds clean. (The separate "startDrag() drag must be active" log was the previous binary; the a3d2c49 fix removes it — relaunch to clear.) --- ui/qml/OutlineView.qml | 73 +++++++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 30 deletions(-) diff --git a/ui/qml/OutlineView.qml b/ui/qml/OutlineView.qml index 6231374..ca5a43e 100644 --- a/ui/qml/OutlineView.qml +++ b/ui/qml/OutlineView.qml @@ -1306,42 +1306,55 @@ ListView { del.editingBody = false } - ScrollView { + // Bordered scroll frame holding the editor. Uses the + // Flickable + TextArea.flickable idiom (not ScrollView), + // which the Breeze style accepts; a custom background on a + // styled TextArea trips Breeze's TextArea internals. + Rectangle { Layout.fillWidth: true Layout.preferredHeight: Math.min( Math.max(bodyEditor.contentHeight + 16, outline.baseFontSize * 6), outline.baseFontSize * 20) - clip: true + color: theme.baseColor + border.color: theme.midColor + border.width: 1 + radius: 3 - TextArea { - id: bodyEditor - wrapMode: TextArea.Wrap - font.family: "monospace" - font.pointSize: outline.baseFontSize - selectByMouse: true - background: Rectangle { - color: theme.baseColor - border.color: theme.midColor - border.width: 1 - radius: 3 - } - // Seed from the raw body when the editor opens. - onVisibleChanged: { - if (visible) { - text = docModel.bodyText(del.index) - forceActiveFocus() - cursorPosition = text.length + Flickable { + id: bodyFlick + anchors.fill: parent + anchors.margins: 4 + clip: true + contentWidth: width + contentHeight: bodyEditor.contentHeight + boundsBehavior: Flickable.StopAtBounds + ScrollBar.vertical: ScrollBar {} + + TextArea.flickable: TextArea { + id: bodyEditor + wrapMode: TextArea.Wrap + font.family: "monospace" + font.pointSize: outline.baseFontSize + selectByMouse: true + background: null + // Seed from the raw body when the editor opens. + onVisibleChanged: { + if (visible) { + text = docModel.bodyText(del.index) + forceActiveFocus() + cursorPosition = text.length + } } - } - // Ctrl+Enter saves; Escape cancels. - Keys.onPressed: (ev) => { - if ((ev.key === Qt.Key_Return || ev.key === Qt.Key_Enter) - && (ev.modifiers & Qt.ControlModifier)) { - bodyEditColumn.saveBody() - ev.accepted = true - } else if (ev.key === Qt.Key_Escape) { - del.editingBody = false - ev.accepted = true + // Ctrl+Enter saves; Escape cancels. + Keys.onPressed: (ev) => { + if ((ev.key === Qt.Key_Return || ev.key === Qt.Key_Enter) + && (ev.modifiers & Qt.ControlModifier)) { + bodyEditColumn.saveBody() + ev.accepted = true + } else if (ev.key === Qt.Key_Escape) { + del.editingBody = false + ev.accepted = true + } } } }