File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -447,8 +447,11 @@ void CTextEditor::SetDocument(QTextDocument* doc, TextFormat fmt)
447447 p.setColor (QPalette::WindowText, Qt::blue); // Foreground was deprecated. Was told to replace with this.
448448 setPalette (p);
449449
450+ setDocument (doc);
451+
450452 if (doc)
451453 {
454+ setDisabled (false );
452455 SetHighlighter (doc, fmt);
453456 }
454457 else
@@ -457,8 +460,6 @@ void CTextEditor::SetDocument(QTextDocument* doc, TextFormat fmt)
457460 updateLineNumberAreaWidth (0 );
458461 }
459462
460- setDocument (doc);
461-
462463 setTabStopDistance (40 );
463464}
464465
@@ -725,7 +726,7 @@ void CTextEditView::deleteLine()
725726
726727void CTextEditView::setDocument (CDocument* doc)
727728{
728- CTextDocument* txtDoc = dynamic_cast <CTextDocument*>(activeDocument () );
729+ CTextDocument* txtDoc = dynamic_cast <CTextDocument*>(doc );
729730 if (txtDoc)
730731 {
731732 QString title = QString::fromStdString (txtDoc->GetDocTitle ());
@@ -740,12 +741,13 @@ void CTextEditView::setDocument(CDocument* doc)
740741 return ;
741742 }
742743
743- CXMLDocument* xmlDoc = dynamic_cast <CXMLDocument*>(activeDocument () );
744+ CXMLDocument* xmlDoc = dynamic_cast <CXMLDocument*>(doc );
744745 if (xmlDoc)
745746 {
746747 m_edit->SetDocument (xmlDoc->GetTextDocument (), CTextEditor::XML);
747748 return ;
748749 }
749750
750- m_edit->clear ();
751+ m_edit->SetDocument (nullptr , CTextEditor::PLAIN);
752+ // m_edit->clear();
751753}
You can’t perform that action at this time.
0 commit comments