tidy signal handling
This commit is contained in:
@@ -70,9 +70,6 @@ int TabWidget::openDocument(const QString &filePath)
|
||||
SciEdit *editor = createEditor();
|
||||
m_editors[docId] = editor;
|
||||
|
||||
// 临时断开信号连接,避免setText触发textChanged导致文档被标记为已修改
|
||||
disconnectEditorSignals(editor);
|
||||
|
||||
// 设置编辑器内容
|
||||
QString content = m_documentManager->getDocumentContent(docId);
|
||||
const QByteArray contentBytes = content.toUtf8();
|
||||
@@ -243,7 +240,6 @@ bool TabWidget::closeTab(int index)
|
||||
// 清理编辑器和文档
|
||||
if (m_editors.contains(docId)) {
|
||||
SciEdit *editor = m_editors[docId];
|
||||
disconnectEditorSignals(editor);
|
||||
m_editors.remove(docId);
|
||||
}
|
||||
|
||||
@@ -435,11 +431,3 @@ void TabWidget::connectEditorSignals(SciEdit *editor)
|
||||
connect(editor, &ScintillaEditBase::savePointChanged, this, &TabWidget::onEditorSavePointChanged);
|
||||
}
|
||||
}
|
||||
|
||||
void TabWidget::disconnectEditorSignals(SciEdit *editor)
|
||||
{
|
||||
if (editor) {
|
||||
disconnect(editor, &SciEdit::textChanged, this, &TabWidget::onEditorTextChanged);
|
||||
disconnect(editor, &ScintillaEditBase::savePointChanged, this, &TabWidget::onEditorSavePointChanged);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user