texteditor.cpp
changeset 746 ee6b0f3a4c2f
parent 729 7ddbe3fa34a1
child 804 14f2b1b15242
     1.1 --- a/texteditor.cpp	Mon Mar 23 09:06:51 2009 +0000
     1.2 +++ b/texteditor.cpp	Thu Mar 26 07:49:17 2009 +0000
     1.3 @@ -186,6 +186,29 @@
     1.4  	return filenameHint;
     1.5  }
     1.6  
     1.7 +QString TextEditor::getText()
     1.8 +{
     1.9 +	if (e->toPlainText().isEmpty())
    1.10 +		return QString();
    1.11 +	else	
    1.12 +		return e->text();
    1.13 +}
    1.14 +
    1.15 +NoteObj TextEditor::getNoteObj()
    1.16 +{
    1.17 +	NoteObj note (getText() );
    1.18 +	note.setFontHint (getFontHint() );
    1.19 +	note.setFilenameHint (getFilenameHint () );
    1.20 +	return note;
    1.21 +}
    1.22 +
    1.23 +void TextEditor::setNote (const NoteObj &note)
    1.24 +{
    1.25 +	setText (note.getNote() );
    1.26 +	setFilenameHint (note.getFilenameHint() );
    1.27 +	setFontHint (note.getFontHint() );
    1.28 +}
    1.29 +
    1.30  bool TextEditor::findText(const QString &t, const QTextDocument::FindFlags &flags)
    1.31  {
    1.32  	if (e->find (t,flags))
    1.33 @@ -504,14 +527,6 @@
    1.34      return;
    1.35  }
    1.36  
    1.37 -QString TextEditor::getText()
    1.38 -{
    1.39 -	if (e->toPlainText().isEmpty())
    1.40 -		return "";
    1.41 -	else	
    1.42 -		return e->text();
    1.43 -}
    1.44 -
    1.45  void TextEditor::editorChanged()
    1.46  {
    1.47  	if (isEmpty())
    1.48 @@ -528,7 +543,7 @@
    1.49  }
    1.50  
    1.51  
    1.52 -void TextEditor::setText(QString t)
    1.53 +void TextEditor::setText(const QString &t)
    1.54  {
    1.55  	blockChangedSignal=true;
    1.56  	e->setReadOnly(false);