From 795d9e52df40d3b5d77c578bde62e6a381084237 Mon Sep 17 00:00:00 2001 From: "Flora (opencode)" Date: Mon, 17 Aug 2026 16:38:22 +0300 Subject: [PATCH] Debug: visible label docIndex/editMode/contentLen + qDebug in openDocument/setActiveIndex + loadContent console.log --- qml/panels/EditorPane.qml | 16 +++++++++++++++- src/core/DocumentManager.cpp | 3 +++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/qml/panels/EditorPane.qml b/qml/panels/EditorPane.qml index fa8008b..61b312b 100644 --- a/qml/panels/EditorPane.qml +++ b/qml/panels/EditorPane.qml @@ -233,6 +233,18 @@ Item { 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: viewer anchors.fill: parent @@ -251,11 +263,13 @@ Item { // ---------- Просмотр (режим просмотра) ---------- function loadContent() { + console.log("loadContent called: docIndex=" + pane.docIndex + " editMode=" + pane.editMode) if (pane.docIndex >= 0) { const c = documentManager.contentAt(pane.docIndex) + console.log("loadContent content=" + c.substring(0, 50) + "...") editor.text = c pane.editorContent = c - console.log("loadContent docIndex=" + pane.docIndex + " len=" + c.length) + console.log("loadContent editor.text.length=" + editor.text.length) } else { editor.text = "" pane.editorContent = "" diff --git a/src/core/DocumentManager.cpp b/src/core/DocumentManager.cpp index 9a6bbf2..7ede2e5 100644 --- a/src/core/DocumentManager.cpp +++ b/src/core/DocumentManager.cpp @@ -31,6 +31,7 @@ QStringList DocumentManager::openTabs() const int DocumentManager::activeIndex() const { return m_active; } void DocumentManager::setActiveIndex(int index) { + qDebug("setActiveIndex: from %d to %d", m_active, index); if (m_active == index) return; m_active = index; @@ -91,6 +92,8 @@ int DocumentManager::openDocument(const QString &path) m_docs.append(doc); const int idx = m_docs.size() - 1; + qDebug("openDocument: path=%s idx=%d content_len=%d", + qPrintable(clean), idx, content.length()); setActiveIndex(idx); emit openTabsChanged(); return idx;