Fix: EditorPane переписан на anchors (headerBar сверху, contentArea снизу); убрана лишняя } после contentArea; ColumnLayout больше не используется в EditorPane/EditorPanel

This commit is contained in:
Flora (opencode)
2026-08-17 18:53:08 +03:00
parent 69a1a6159c
commit 4bbbf64999
+75 -92
View File
@@ -149,104 +149,88 @@ Item {
replaceRange(s, e, out.join("\n")) replaceRange(s, e, out.join("\n"))
} }
ColumnLayout { // ---------- Шапка (сверху) ----------
anchors.fill: parent Rectangle {
spacing: 0 id: headerBar
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
height: 30
color: "whitesmoke"
Rectangle { RowLayout {
Layout.fillWidth: true anchors.fill: parent
implicitHeight: 30 anchors.leftMargin: 8
color: "whitesmoke" anchors.rightMargin: 4
spacing: 6
RowLayout { Label {
anchors.fill: parent id: headerTitle
anchors.leftMargin: 8 Layout.fillWidth: true
anchors.rightMargin: 4 elide: Text.ElideMiddle
spacing: 6 color: "#444"
text: ""
}
Label { ToolButton {
id: headerTitle text: "✎"
Layout.fillWidth: true checkable: true
elide: Text.ElideMiddle checked: pane.editMode
color: "#444" ToolTip.text: qsTr("Редактирование")
text: "" onClicked: { pane.editMode = true; editBtn.checked = true; viewBtn.checked = false }
} }
ToolButton {
// Переключатель режимов id: viewBtn
ToolButton { text: "👁"
text: "✎" checkable: true
checkable: true checked: !pane.editMode
checked: pane.editMode ToolTip.text: qsTr("Просмотр")
ToolTip.visible: hovered onClicked: { pane.editMode = false; editBtn.checked = false; viewBtn.checked = true }
ToolTip.text: qsTr("Режим редактирования (Ctrl+E)") }
onClicked: { pane.editMode = true; editBtn.checked = true; viewBtn.checked = false } ToolButton {
} id: editBtn
ToolButton { visible: false
id: viewBtn checkable: true
text: "👁" checked: true
checkable: true onClicked: { pane.editMode = true; viewBtn.checked = false }
checked: !pane.editMode }
ToolTip.visible: hovered ToolButton {
ToolTip.text: qsTr("Режим просмотра (Ctrl+E)") text: "\u25B8\u25CB\u25C0"
onClicked: { pane.editMode = false; editBtn.checked = false; viewBtn.checked = true } visible: pane.canOpenBeside && !documentManager.sideBySide
} ToolTip.text: qsTr("Открыть рядом")
onClicked: pane.openBeside()
ToolButton { }
id: editBtn ToolButton {
visible: false text: "\u2715"
checkable: true visible: pane.closable
checked: true ToolTip.text: qsTr("Закрыть панель")
onClicked: { pane.editMode = true; viewBtn.checked = false } onClicked: pane.closePane()
}
ToolButton {
text: "\u25B8\u25CB\u25C0" // «открыть рядом» (две панели)
visible: pane.canOpenBeside && !documentManager.sideBySide
ToolTip.visible: hovered
ToolTip.text: qsTr("Открыть рядом (две панели)")
onClicked: pane.openBeside()
}
ToolButton {
text: "\u2715"
visible: pane.closable
ToolTip.visible: hovered
ToolTip.text: qsTr("Закрыть вторую панель")
onClicked: pane.closePane()
}
} }
} }
}
Rectangle { // ---------- Область контента (под шапкой, заполняет остаток) ----------
Layout.fillWidth: true Rectangle {
Layout.fillHeight: true id: contentArea
color: "white" anchors.top: headerBar.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
color: "white"
TextArea { TextArea {
id: editor id: editor
anchors.fill: parent anchors.fill: parent
visible: pane.editMode visible: pane.editMode
color: "black" color: "black"
onTextEdited: documentManager.updateContent(pane.docIndex, text) onTextEdited: documentManager.updateContent(pane.docIndex, text)
selectByMouse: true selectByMouse: true
font.family: "Menlo, Consolas, 'DejaVu Sans Mono', monospace" font.family: "Menlo, Consolas, 'DejaVu Sans Mono', monospace"
font.pixelSize: 14 font.pixelSize: 14
wrapMode: TextEdit.NoWrap wrapMode: TextEdit.NoWrap
padding: 10 padding: 10
placeholderText: qsTr("Документ не выбран") placeholderText: qsTr("Документ не выбран")
} }
// Отладочный индикатор (временно)
Label {
visible: true
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.margins: 4
font.pixelSize: 10
color: "#999"
text: "docIndex=" + pane.docIndex + " editMode=" + pane.editMode
+ " contentLen=" + editor.text.length
}
TextArea { TextArea {
id: viewer id: viewer
@@ -262,7 +246,6 @@ Item {
placeholderText: qsTr("Документ не выбран") placeholderText: qsTr("Документ не выбран")
} }
} }
}
// ---------- Просмотр (режим просмотра) ---------- // ---------- Просмотр (режим просмотра) ----------
function loadContent() { function loadContent() {