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
+17 -34
View File
@@ -149,13 +149,13 @@ Item {
replaceRange(s, e, out.join("\n")) replaceRange(s, e, out.join("\n"))
} }
ColumnLayout { // ---------- Шапка (сверху) ----------
anchors.fill: parent
spacing: 0
Rectangle { Rectangle {
Layout.fillWidth: true id: headerBar
implicitHeight: 30 anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
height: 30
color: "whitesmoke" color: "whitesmoke"
RowLayout { RowLayout {
@@ -172,13 +172,11 @@ Item {
text: "" text: ""
} }
// Переключатель режимов
ToolButton { ToolButton {
text: "✎" text: "✎"
checkable: true checkable: true
checked: pane.editMode checked: pane.editMode
ToolTip.visible: hovered ToolTip.text: qsTr("Редактирование")
ToolTip.text: qsTr("Режим редактирования (Ctrl+E)")
onClicked: { pane.editMode = true; editBtn.checked = true; viewBtn.checked = false } onClicked: { pane.editMode = true; editBtn.checked = true; viewBtn.checked = false }
} }
ToolButton { ToolButton {
@@ -186,11 +184,9 @@ Item {
text: "👁" text: "👁"
checkable: true checkable: true
checked: !pane.editMode checked: !pane.editMode
ToolTip.visible: hovered ToolTip.text: qsTr("Просмотр")
ToolTip.text: qsTr("Режим просмотра (Ctrl+E)")
onClicked: { pane.editMode = false; editBtn.checked = false; viewBtn.checked = true } onClicked: { pane.editMode = false; editBtn.checked = false; viewBtn.checked = true }
} }
ToolButton { ToolButton {
id: editBtn id: editBtn
visible: false visible: false
@@ -198,28 +194,28 @@ Item {
checked: true checked: true
onClicked: { pane.editMode = true; viewBtn.checked = false } onClicked: { pane.editMode = true; viewBtn.checked = false }
} }
ToolButton { ToolButton {
text: "\u25B8\u25CB\u25C0" // «открыть рядом» (две панели) text: "\u25B8\u25CB\u25C0"
visible: pane.canOpenBeside && !documentManager.sideBySide visible: pane.canOpenBeside && !documentManager.sideBySide
ToolTip.visible: hovered ToolTip.text: qsTr("Открыть рядом")
ToolTip.text: qsTr("Открыть рядом (две панели)")
onClicked: pane.openBeside() onClicked: pane.openBeside()
} }
ToolButton { ToolButton {
text: "\u2715" text: "\u2715"
visible: pane.closable visible: pane.closable
ToolTip.visible: hovered ToolTip.text: qsTr("Закрыть панель")
ToolTip.text: qsTr("Закрыть вторую панель")
onClicked: pane.closePane() onClicked: pane.closePane()
} }
} }
} }
// ---------- Область контента (под шапкой, заполняет остаток) ----------
Rectangle { Rectangle {
Layout.fillWidth: true id: contentArea
Layout.fillHeight: true anchors.top: headerBar.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
color: "white" color: "white"
TextArea { TextArea {
@@ -236,18 +232,6 @@ Item {
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
anchors.fill: parent anchors.fill: parent
@@ -262,7 +246,6 @@ Item {
placeholderText: qsTr("Документ не выбран") placeholderText: qsTr("Документ не выбран")
} }
} }
}
// ---------- Просмотр (режим просмотра) ---------- // ---------- Просмотр (режим просмотра) ----------
function loadContent() { function loadContent() {