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"))
}
ColumnLayout {
anchors.fill: parent
spacing: 0
// ---------- Шапка (сверху) ----------
Rectangle {
id: headerBar
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
height: 30
color: "whitesmoke"
Rectangle {
Layout.fillWidth: true
implicitHeight: 30
color: "whitesmoke"
RowLayout {
anchors.fill: parent
anchors.leftMargin: 8
anchors.rightMargin: 4
spacing: 6
RowLayout {
anchors.fill: parent
anchors.leftMargin: 8
anchors.rightMargin: 4
spacing: 6
Label {
id: headerTitle
Layout.fillWidth: true
elide: Text.ElideMiddle
color: "#444"
text: ""
}
Label {
id: headerTitle
Layout.fillWidth: true
elide: Text.ElideMiddle
color: "#444"
text: ""
}
// Переключатель режимов
ToolButton {
text: "✎"
checkable: true
checked: pane.editMode
ToolTip.visible: hovered
ToolTip.text: qsTr("Режим редактирования (Ctrl+E)")
onClicked: { pane.editMode = true; editBtn.checked = true; viewBtn.checked = false }
}
ToolButton {
id: viewBtn
text: "👁"
checkable: true
checked: !pane.editMode
ToolTip.visible: hovered
ToolTip.text: qsTr("Режим просмотра (Ctrl+E)")
onClicked: { pane.editMode = false; editBtn.checked = false; viewBtn.checked = true }
}
ToolButton {
id: editBtn
visible: false
checkable: true
checked: true
onClicked: { pane.editMode = true; viewBtn.checked = false }
}
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()
}
ToolButton {
text: "✎"
checkable: true
checked: pane.editMode
ToolTip.text: qsTr("Редактирование")
onClicked: { pane.editMode = true; editBtn.checked = true; viewBtn.checked = false }
}
ToolButton {
id: viewBtn
text: "👁"
checkable: true
checked: !pane.editMode
ToolTip.text: qsTr("Просмотр")
onClicked: { pane.editMode = false; editBtn.checked = false; viewBtn.checked = true }
}
ToolButton {
id: editBtn
visible: false
checkable: true
checked: true
onClicked: { pane.editMode = true; viewBtn.checked = false }
}
ToolButton {
text: "\u25B8\u25CB\u25C0"
visible: pane.canOpenBeside && !documentManager.sideBySide
ToolTip.text: qsTr("Открыть рядом")
onClicked: pane.openBeside()
}
ToolButton {
text: "\u2715"
visible: pane.closable
ToolTip.text: qsTr("Закрыть панель")
onClicked: pane.closePane()
}
}
}
Rectangle {
Layout.fillWidth: true
Layout.fillHeight: true
color: "white"
// ---------- Область контента (под шапкой, заполняет остаток) ----------
Rectangle {
id: contentArea
anchors.top: headerBar.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
color: "white"
TextArea {
id: editor
anchors.fill: parent
visible: pane.editMode
color: "black"
onTextEdited: documentManager.updateContent(pane.docIndex, text)
selectByMouse: true
font.family: "Menlo, Consolas, 'DejaVu Sans Mono', monospace"
font.pixelSize: 14
wrapMode: TextEdit.NoWrap
padding: 10
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 {
id: editor
anchors.fill: parent
visible: pane.editMode
color: "black"
onTextEdited: documentManager.updateContent(pane.docIndex, text)
selectByMouse: true
font.family: "Menlo, Consolas, 'DejaVu Sans Mono', monospace"
font.pixelSize: 14
wrapMode: TextEdit.NoWrap
padding: 10
placeholderText: qsTr("Документ не выбран")
}
TextArea {
id: viewer
@@ -262,7 +246,6 @@ Item {
placeholderText: qsTr("Документ не выбран")
}
}
}
// ---------- Просмотр (режим просмотра) ----------
function loadContent() {