diff -r 338ebdc9b947 -r 14f2b1b15242 texteditor.cpp --- a/texteditor.cpp Fri Oct 02 14:31:03 2009 +0000 +++ b/texteditor.cpp Fri Nov 13 08:32:03 2009 +0000 @@ -15,6 +15,8 @@ extern QString iconPath; extern QString vymName; +extern bool debug; + using namespace std; @@ -110,6 +112,30 @@ } +void TextEditor::reset() +{ + e->clear(); + actionFormatUseFixedFont->setOn (false); + actionTextBold->setOn (false); + e->setBold (false); + + actionTextUnderline->setOn (false); + e->setUnderline (false); + + actionTextItalic->setOn (false); + e->setItalic (false); + + QPixmap pix( 16, 16 ); + pix.fill( Qt::black ); + actionTextColor->setIconSet( pix ); + e->setColor (Qt::black); + + actionAlignSubScript->setOn (false); + actionAlignSuperScript->setOn (false); + actionAlignLeft->setOn (true); + e->setAlignment( Qt::AlignLeft ); +} + bool TextEditor::isEmpty() { if (e->toPlainText().length()>0) @@ -547,7 +573,14 @@ { blockChangedSignal=true; e->setReadOnly(false); - e->setText(t); + reset(); + if (Qt::mightBeRichText (t)) + e->setHtml(t); + else + { + actionFormatUseFixedFont->setChecked (true); + e->setPlainText(t); + } enableActions(); blockChangedSignal=false; }