diff -r 46553c106c52 -r bec082472471 texteditor.cpp --- a/texteditor.cpp Mon Mar 22 15:37:23 2010 +0000 +++ b/texteditor.cpp Tue Mar 30 17:30:39 2010 +0000 @@ -232,18 +232,40 @@ setFontHint (note.getFontHint() ); } -bool TextEditor::findText(const QString &t, const QTextDocument::FindFlags &flags, QTextCursor &cursor) +bool TextEditor::findText(const QString &t, const QTextDocument::FindFlags &flags) { if (e->find (t,flags)) + return true; + else + return false; +} + +bool TextEditor::findText(const QString &t, const QTextDocument::FindFlags &flags, int i) +{ + // Position at beginning + QTextCursor c=e->textCursor(); + c.setPosition (0,QTextCursor::MoveAnchor); + e->setTextCursor (c); + + // Search for t + int j=0; + while (j<=i) { - cursor=e->textCursor(); - return true; - } - else - { - cursor=QTextCursor(); - return false; + if (!e->find (t,flags)) return false; + j++; } + return true; + +} + +void TextEditor::setTextCursor (const QTextCursor &cursor) +{ + e->setTextCursor (cursor); +} + +QTextCursor TextEditor::getTextCursor() +{ + return e->textCursor(); } void TextEditor::setupFileActions() @@ -808,6 +830,11 @@ void TextEditor::textAlign( QAction *a ) { + qDebug()<<"TE::textAlign"; + QTextCursor c=e->textCursor(); + c.setPosition (3,QTextCursor::MoveAnchor); + e->setTextCursor (c); + if ( a == actionAlignLeft ) e->setAlignment( Qt::AlignLeft ); else if ( a == actionAlignCenter )