81void TextEditFindWidget::find(
const QString &ttf,
bool skipCurrent,
bool backward,
bool *found,
bool *wrapped)
86 QTextCursor cursor = m_textEdit->textCursor();
87 QTextDocument *doc = m_textEdit->document();
89 if (!doc || cursor.isNull())
92 if (cursor.hasSelection())
93 cursor.setPosition((skipCurrent && !backward) ? cursor.position() : cursor.anchor());
96 QTextCursor newCursor = cursor;
99 QTextDocument::FindFlags options;
102 options |= QTextDocument::FindBackward;
105 options |= QTextDocument::FindCaseSensitively;
108 options |= QTextDocument::FindWholeWords;
110 newCursor = doc->find(ttf, cursor, options);
111 if (newCursor.isNull()) {
113 ac.movePosition(options & QTextDocument::FindBackward
114 ? QTextCursor::End : QTextCursor::Start);
115 newCursor = doc->find(ttf, ac, options);
116 if (newCursor.isNull()) {
128 m_textEdit->setTextCursor(newCursor);