Debug: visible label docIndex/editMode/contentLen + qDebug in openDocument/setActiveIndex + loadContent console.log
This commit is contained in:
@@ -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 = ""
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user