42 #ifndef QTEXTDOCUMENT_H 43 #define QTEXTDOCUMENT_H 45 #include <QtCore/qobject.h> 46 #include <QtCore/qsize.h> 47 #include <QtCore/qrect.h> 48 #include <QtGui/qfont.h> 74 template<
typename T>
class QVector;
90 #ifndef QT_NO_TEXTCODEC 99 virtual void undo() = 0;
100 virtual void redo() = 0;
122 #ifndef QT_NO_CSSPARSER 137 virtual void clear();
139 void setUndoRedoEnabled(
bool enable);
140 bool isUndoRedoEnabled()
const;
142 bool isUndoAvailable()
const;
143 bool isRedoAvailable()
const;
145 int availableUndoSteps()
const;
146 int availableRedoSteps()
const;
148 int revision()
const;
160 #ifndef QT_NO_TEXTHTMLPARSER 162 void setHtml(
const QString &html);
168 QChar characterAt(
int pos)
const;
172 FindBackward = 0x00001,
173 FindCaseSensitively = 0x00002,
174 FindWholeWords = 0x00004
178 QTextCursor find(
const QString &subString,
int from = 0, FindFlags options = 0)
const;
191 QTextBlock findBlockByNumber(
int blockNumber)
const;
192 QTextBlock findBlockByLineNumber(
int blockNumber)
const;
199 void setPageSize(
const QSizeF &size);
202 void setDefaultFont(
const QFont &font);
203 QFont defaultFont()
const;
205 int pageCount()
const;
207 bool isModified()
const;
209 #ifndef QT_NO_PRINTER 210 void print(
QPrinter *printer)
const;
216 StyleSheetResource = 3,
226 void markContentsDirty(
int from,
int length);
228 void setUseDesignMetrics(
bool b);
229 bool useDesignMetrics()
const;
233 void setTextWidth(
qreal width);
234 qreal textWidth()
const;
236 qreal idealWidth()
const;
238 qreal indentWidth()
const;
239 void setIndentWidth(
qreal width);
241 qreal documentMargin()
const;
242 void setDocumentMargin(
qreal margin);
247 int blockCount()
const;
248 int lineCount()
const;
249 int characterCount()
const;
251 #ifndef QT_NO_CSSPARSER 252 void setDefaultStyleSheet(
const QString &sheet);
253 QString defaultStyleSheet()
const;
262 UndoAndRedoStacks = UndoStack | RedoStack
264 void clearUndoRedoStacks(
Stacks historyToClear = UndoAndRedoStacks);
266 int maximumBlockCount()
const;
267 void setMaximumBlockCount(
int maximum);
270 void setDefaultTextOption(
const QTextOption &option);
276 void contentsChange(
int from,
int charsRemoves,
int charsAdded);
277 void contentsChanged();
278 void undoAvailable(
bool);
279 void redoAvailable(
bool);
280 void undoCommandAdded();
281 void modificationChanged(
bool m);
282 void cursorPositionChanged(
const QTextCursor &cursor);
283 void blockCountChanged(
int newBlockCount);
285 void documentLayoutChanged();
291 void setModified(
bool m =
true);
312 #endif // QTEXTDOCUMENT_H The QVariant class acts like a union for the most common Qt data types.
The QPainter class performs low-level painting on widgets and other paint devices.
QSizeF pageSize
the page size that should be used for laying out the document
The QTextListFormat class provides formatting information for lists in a QTextDocument.
static mach_timebase_info_data_t info
#define QT_END_NAMESPACE
This macro expands to.
#define QDOC_PROPERTY(text)
Q_GUI_EXPORT QString convertFromPlainText(const QString &plain, WhiteSpaceMode mode=WhiteSpacePre)
Converts the plain text string plain to an HTML-formatted paragraph while preserving most of its look...
The QRegExp class provides pattern matching using regular expressions.
#define Q_DECLARE_FLAGS(Flags, Enum)
The Q_DECLARE_FLAGS() macro expands to.
int blockCount
Returns the number of text blocks in the document.
The QTextFrame class represents a frame in a QTextDocument.
int maximumBlockCount
Specifies the limit for blocks in the document.
The QByteArray class provides an array of bytes.
static void clear(QVariant::Private *d)
Q_GUI_EXPORT bool mightBeRichText(const QString &)
Returns true if the string text is likely to be rich text; otherwise returns false.
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
The QUrl class provides a convenient interface for working with URLs.
The QString class provides a Unicode character string.
QFont defaultFont
the default font used to display the document's text
The QVector class is a template class that provides a dynamic array.
The QObject class is the base class of all Qt objects.
ResourceType
This enum describes the types of resources that can be loaded by QTextDocument's loadResource() funct...
The QSizeF class defines the size of a two-dimensional object using floating point precision...
The QChar class provides a 16-bit Unicode character.
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QRectF class defines a rectangle in the plane using floating point precision. ...
static bool isEmpty(const char *str)
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
The Q_DECLARE_OPERATORS_FOR_FLAGS() macro declares global operator|() functions for Flags...
The QTextFormat class provides formatting information for a QTextDocument.
The QTextCursor class offers an API to access and modify QTextDocuments.
The QPrinter class is a paint device that paints on a printer.
The QTextBlock class provides a container for text fragments in a QTextDocument.
QSizeF size
Returns the actual size of the document.
bool modified
whether the document has been modified by the user
bool undoRedoEnabled
whether undo/redo are enabled for this document
Q_GUI_EXPORT QString escape(const QString &plain)
Converts the plain text string plain to a HTML string with HTML metacharacters <, >...
MetaInformation
This enum describes the different types of meta information that can be added to a document...
QString defaultStyleSheet
The default style sheet is applied to all newly HTML formatted text that is inserted into the documen...
FindFlag
This enum describes the options available to QTextDocument's find function.
CursorMoveStyle
This enum describes the movement style available to text cursors.
The QFont class specifies a font used for drawing text.
The QPoint class defines a point in the plane using integer precision.
The QRect class defines a rectangle in the plane using integer precision.
The QTextOption class provides a description of general rich text properties.
qreal documentMargin
The margin around the document.
The QTextDocument class holds formatted text that can be viewed and edited using a QTextEdit...
#define Q_DECLARE_PRIVATE(Class)
virtual ~QAbstractUndoItem()=0
The QTextCodec class provides conversions between text encodings.
The QTextObject class is a base class for different kinds of objects that can group parts of a QTextD...
static const KeyPair *const end
qreal indentWidth
Returns the width used for text list and text block indenting.
bool useDesignMetrics
whether the document uses design metrics of fonts to improve the accuracy of text layout ...
qreal textWidth
The text width specifies the preferred width for text in the document.
Q_GUI_EXPORT QTextCodec * codecForHtml(const QByteArray &ba)
This function is defined in the <QTextDocument> header file.
The QAbstractTextDocumentLayout class is an abstract base class used to implement custom layouts for ...