QTextDocument is a class in Qt library used to represent a text document. It is a rich text document with formatting and layout options.
QTextDocument has several functions to search the contents of the document including find, findBlock and findBlocks. The find function searches for a given string in the document and returns a QTextCursor pointing to the first occurrence of that string. Here is an example code snippet to search for the occurrence of a string in a QTextDocument:
QTextDocument doc;
//... Add content to the document
QTextCursor cursor(&doc);
if (cursor.find("search_string")) {
//... Do something when the string is found
}
The QTextDocument class is part of the QtGui package in Qt library.
C++ (Cpp) QTextDocument::find - 30 examples found. These are the top rated real world C++ (Cpp) examples of QTextDocument::find extracted from open source projects. You can rate examples to help us improve the quality of examples.