50 #if QT_CONFIG(regularexpression)
64 #include "private/qdataurl_p.h"
67 #include <private/qabstracttextdocumentlayout_p.h>
69 #include "private/qpagedpaintdevice_p.h"
70 #if QT_CONFIG(textmarkdownreader)
71 #include <private/qtextmarkdownimporter_p.h>
73 #if QT_CONFIG(textmarkdownwriter)
74 #include <private/qtextmarkdownwriter_p.h>
136 for (
int i =
open+1;
i < close; ++
i) {
139 else if (!
tag.isEmpty() &&
text[
i].isSpace())
146 #ifndef QT_NO_TEXTHTMLPARSER
171 for (
int i = 0;
i < plain.
length(); ++
i) {
341 if (blockFormat.isValid() && !blockFormat.isEmpty())
345 if (blockCharFormat.isValid() && !blockCharFormat.isEmpty())
359 priv->resources =
d->resources;
360 priv->cachedResources.
clear();
361 priv->resourceProvider =
d->resourceProvider;
362 #ifndef QT_NO_CSSPARSER
363 priv->defaultStyleSheet =
d->defaultStyleSheet;
377 return d->length() <= 1;
387 d->resources.clear();
405 const int pos =
d->undoRedo(
true);
422 const int pos =
d->undoRedo(
false);
450 d->clearUndoRedoStacks(stacksToClear,
true);
481 d->appendUndoItem(
item);
500 return d->isUndoRedoEnabled();
527 return d->maximumBlockCount;
533 d->maximumBlockCount = maximum;
534 d->ensureMaximumBlockCount();
548 return d->defaultTextOption;
561 d->lout->documentChanged(0, 0,
d->length());
589 if (
d->baseUrl !=
url) {
592 d->lout->documentChanged(0, 0,
d->length());
606 return d->defaultCursorMoveStyle;
617 d->defaultCursorMoveStyle =
style;
630 d->documentChange(from,
length);
631 if (!
d->inContentsChange) {
633 d->lout->documentChanged(
d->docChangeFrom,
d->docChangeOldLength,
d->docChangeLength);
634 d->docChangeFrom = -1;
658 if (
b ==
d->defaultTextOption.useDesignMetrics())
660 d->defaultTextOption.setUseDesignMetrics(
b);
662 d->lout->documentChanged(0, 0,
d->length());
668 return d->defaultTextOption.useDesignMetrics();
681 if (
rect.isValid()) {
682 p->setClipRect(
rect);
722 return d->pageSize.width();
736 return lout->idealWidth();
749 return d->documentMargin;
755 if (
d->documentMargin != margin) {
756 d->documentMargin = margin;
764 d->lout->documentChanged(0, 0,
d->length());
781 return d->indentWidth;
798 if (
d->indentWidth !=
width) {
801 d->lout->documentChanged(0, 0,
d->length());
824 if (
size.width() != 0) {
829 if (
w*3 < 5*
size.height()) {
873 return d->blockMap().numNodes();
888 return d->blockMap().length(2);
918 if (pos < 0 || pos >=
d->length())
922 const int offsetInFragment = qMax(0,
pos - fragIt.position());
942 #ifndef QT_NO_CSSPARSER
946 d->defaultStyleSheet = sheet;
950 parser.parse(&
d->parsedDefaultStyleSheet);
956 return d->defaultStyleSheet;
1044 return d->isUndoAvailable();
1055 return d->isRedoAvailable();
1067 return d->availableUndoSteps();
1079 return d->availableRedoSteps();
1178 return d->plainText();
1206 for (; uc !=
e; ++uc) {
1233 bool previousState =
d->isUndoRedoEnabled();
1234 d->enableUndoRedo(
false);
1235 d->beginEditBlock();
1239 d->enableUndoRedo(previousState);
1261 #ifndef QT_NO_TEXTHTMLPARSER
1266 bool previousState =
d->isUndoRedoEnabled();
1267 d->enableUndoRedo(
false);
1268 d->beginEditBlock();
1272 d->enableUndoRedo(previousState);
1373 int blockOffset =
pos -
block.position();
1376 while (
block.isValid()) {
1377 if (findInBlock(
block, subString, blockOffset, options, &
cursor))
1383 if (blockOffset ==
block.length() - 1)
1385 while (
block.isValid()) {
1386 if (findInBlock(
block, subString, blockOffset, options, &
cursor))
1389 blockOffset =
block.length() - 2;
1421 return find(subString,
pos, options);
1424 #if QT_CONFIG(regularexpression)
1493 int blockOffset =
pos -
block.position();
1502 while (
block.isValid()) {
1503 if (findInBlock(
block, expression, blockOffset, options, &
cursor))
1509 while (
block.isValid()) {
1510 if (findInBlock(
block, expression, blockOffset, options, &
cursor))
1513 blockOffset =
block.length() - 1;
1548 return find(expr,
pos, options);
1564 if (
f.isListFormat())
1566 else if (
f.isTableFormat())
1568 else if (
f.isFrameFormat())
1582 return d->frameAt(
pos);
1591 return d->rootFrame();
1600 return d->objectForIndex(objectIndex);
1609 return d->objectForFormat(
f);
1714 d->lout->documentChanged(0, 0,
d->length());
1737 d->setDefaultFont(
font);
1739 d->lout->documentChanged(0, 0,
d->length());
1748 return d->defaultFont();
1763 d->formats.setSuperScriptBaseline(baseline);
1777 return d->formats.defaultTextFormat().superScriptBaseline();
1792 d->formats.setSubScriptBaseline(baseline);
1806 return d->formats.defaultTextFormat().subScriptBaseline();
1822 d->formats.setBaselineOffset(baseline);
1836 return d->formats.defaultTextFormat().baselineOffset();
1865 return d->isModified();
1874 #ifndef QT_NO_PRINTER
1879 QRectF view(0, (
index - 1) * body.height(), body.width(), body.height());
1894 if (!pageNumberPos.
isNull()) {
1932 bool documentPaginated =
d->pageSize.isValid() && !
d->pageSize.isNull()
1933 &&
d->pageSize.height() != INT_MAX;
1937 if (!documentPaginated &&
m.left() == 0. &&
m.right() == 0. &&
m.top() == 0. &&
m.bottom() == 0.) {
1964 if (documentPaginated) {
1973 p.scale(dpiScaleX, dpiScaleY);
1975 QSizeF scaledPageSize =
d->pageSize;
1976 scaledPageSize.
rwidth() *= dpiScaleX;
1977 scaledPageSize.
rheight() *= dpiScaleY;
1982 p.scale(printerPageSize.
width() / scaledPageSize.
width(),
1989 srcBlock.isValid() && dstBlock.isValid();
1990 srcBlock = srcBlock.next(), dstBlock = dstBlock.next()) {
1991 dstBlock.layout()->setFormats(srcBlock.layout()->formats());
1995 layout->setPaintDevice(
p.device());
2001 const int horizontalMargin = int((2/2.54)*sourceDpiX);
2002 const int verticalMargin = int((2/2.54)*sourceDpiY);
2011 const int dpiy =
p.device()->logicalDpiY();
2013 pageNumberPos =
QPointF(body.width() - horizontalMargin * dpiScaleX,
2014 body.height() - verticalMargin * dpiScaleY
2017 clonedDoc->setPageSize(body.size());
2022 int toPage = pageRanges.
lastPage();
2024 if (fromPage == 0 && toPage == 0) {
2029 fromPage = qMax(1, fromPage);
2030 toPage = qMin(doc->
pageCount(), toPage);
2032 if (toPage < fromPage) {
2046 int page = fromPage;
2049 printPage(
page, &
p, doc, body, pageNumberPos);
2109 r =
d->cachedResources.value(
url);
2113 if (
d->resourceProvider)
2114 r =
d->resourceProvider(
url);
2116 r = defaultProvider(
url);
2158 return d->resourceProvider;
2178 d->resourceProvider = provider;
2193 qt_defaultResourceProvider = provider;
2205 return qt_defaultResourceProvider;
2251 if (!qobject_cast<QTextDocument *>(
p) &&
r.isNull()) {
2254 if (
name.isRelative()) {
2255 QUrl currentURL =
d->url;
2261 || (
name.hasFragment() &&
name.path().isEmpty())) {
2271 }
else if (currentURL.
isEmpty()) {
2290 image.loadFromData(
r.toByteArray());
2291 if (!
image.isNull())
2300 d->cachedResources.insert(
name,
r);
2322 if (
color.alpha() == 255) {
2324 }
else if (
color.alpha()) {
2342 : doc(_doc), fragmentMarkers(
false)
2345 defaultCharFormat.
setFont(defaultFont);
2350 return format.fontFamilies().toStringList();
2360 html =
QLatin1String(
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" "
2361 "\"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
2362 "<html><head><meta name=\"qrichtext\" content=\"1\" />");
2373 html +=
QLatin1String(
"p, li { white-space: pre-wrap; }\n");
2374 html +=
QLatin1String(
"hr { height: 1px; border-width: 0; }\n");
2381 emitFontFamily(resolvedFontFamilies(defaultCharFormat));
2420 bool atLeastOneDecorationSet =
false;
2424 atLeastOneDecorationSet =
true;
2430 atLeastOneDecorationSet =
true;
2436 atLeastOneDecorationSet =
true;
2439 if (atLeastOneDecorationSet)
2445 emitBackgroundAttribute(fmt);
2458 if (rootFmt == defaultFmt)
2478 bool attributesEmitted =
false;
2482 if (!families.isEmpty() && families != resolvedFontFamilies(defaultCharFormat)) {
2483 emitFontFamily(families);
2484 attributesEmitted =
true;
2493 attributesEmitted =
true;
2495 static const char sizeNameData[] =
2499 static const quint8 sizeNameOffsets[] = {
2502 sizeof(
"small") +
sizeof(
"medium") + 3,
2503 sizeof(
"small") +
sizeof(
"medium") + 1,
2504 sizeof(
"small") +
sizeof(
"medium"),
2506 const char *
name =
nullptr;
2508 if (
idx >= 0 &&
idx <= 4) {
2509 name = sizeNameData + sizeNameOffsets[
idx];
2515 attributesEmitted =
true;
2521 attributesEmitted =
true;
2529 attributesEmitted =
true;
2537 attributesEmitted =
true;
2541 html += decorationTag;
2542 bool hasDecoration =
false;
2543 bool atLeastOneDecorationSet =
false;
2547 hasDecoration =
true;
2548 if (
format.fontUnderline()) {
2550 atLeastOneDecorationSet =
true;
2556 hasDecoration =
true;
2557 if (
format.fontOverline()) {
2559 atLeastOneDecorationSet =
true;
2565 hasDecoration =
true;
2566 if (
format.fontStrikeOut()) {
2568 atLeastOneDecorationSet =
true;
2572 if (hasDecoration) {
2573 if (!atLeastOneDecorationSet)
2578 html += colorValue(
format.underlineColor());
2581 attributesEmitted =
true;
2583 html.
chop(decorationTag.size());
2591 const qint64 cacheKey = isPixmap ?
brush.texture().cacheKey() :
brush.textureImage().cacheKey();
2598 html += colorValue(
brush.color());
2601 attributesEmitted =
true;
2607 html += colorValue(
format.background().color());
2609 attributesEmitted =
true;
2630 attributesEmitted =
true;
2641 attributesEmitted =
true;
2644 if (
format.fontWordSpacing() != 0.0) {
2648 attributesEmitted =
true;
2651 return attributesEmitted;
2687 if (
mode == EmitStyleTag)
2697 Q_ASSERT_X(0,
"QTextHtmlExporter::emitFloatStyle()",
"pos should be a valid enum type");
2699 if (
mode == EmitStyleTag)
2739 html += richtextBorderStyleToHtmlBorderStyle(
style);
2743 void QTextHtmlExporter::emitPageBreakPolicy(QTextFormat::PageBreakFlags
policy)
2752 void QTextHtmlExporter::emitFontFamily(
const QStringList &families)
2757 for (
const QString &family : families) {
2792 void QTextHtmlExporter::emitFragment(
const QTextFragment &fragment)
2796 bool closeAnchor =
false;
2800 if (!
names.isEmpty()) {
2816 const bool isImage = isObject &&
format.isImageFormat();
2821 bool attributesEmitted =
false;
2823 attributesEmitted = emitCharFormatStyle(
format);
2824 if (attributesEmitted)
2827 html.
chop(styleTag.size());
2830 for (
int i = 0; isImage &&
i <
txt.length(); ++
i) {
2836 emitAttribute(
"src", imgFmt.
name());
2851 html +=
QLatin1String(
" style=\"vertical-align: middle;\"");
2856 emitFloatStyle(imageFrame->frameFormat().position());
2863 txt =
txt.toHtmlEscaped();
2872 if (attributesEmitted)
2879 static bool isOrderedList(
int style)
2891 emitAlignment(
format.alignment());
2901 const bool emptyBlock =
block.begin().atEnd();
2919 if (
block.userState() != -1) {
2928 switch (
format.lineHeightType()) {
2939 html +=
QLatin1String(
"; -qt-line-height-type: line-distance;");
2947 emitPageBreakPolicy(
format.pageBreakPolicy());
2952 diff = formatDifference(defaultCharFormat, blockCharFmt).
toCharFormat();
2963 emitCharFormatStyle(diff);
2971 if (
block.begin().atEnd()) {
2973 int p =
block.position();
3021 styleString += numberPrefix;
3033 styleString += numberSuffix;
3040 html += styleString;
3049 emitCharFormatStyle(blockFmt);
3062 emitTextLength(
"width",
width);
3084 if (headingLevel > 0 && headingLevel <= 6)
3090 emitBlockAttributes(
block);
3093 if (
block.begin().atEnd())
3097 if (fragmentMarkers && !
it.atEnd() &&
block == doc->
begin())
3100 for (; !
it.atEnd(); ++
it)
3101 emitFragment(
it.fragment());
3114 if (headingLevel > 0 && headingLevel <= 6)
3122 if (isOrderedList(
list->format().style()))
3135 if (!closingTags.isEmpty() &&
list->itemNumber(
block) ==
list->count() - 1)
3136 lastTag = closingTags.takeLast();
3138 closingTags << lastTag;
3143 if (!closingTags.isEmpty())
3144 html += closingTags.takeLast();
3150 defaultCharFormat = oldDefaultCharFormat;
3162 return findUrlForImage(
parent, cacheKey, isPixmap);
3171 if (
v.userType() == QMetaType::QImage && !isPixmap) {
3172 if (qvariant_cast<QImage>(
v).cacheKey() == cacheKey)
3176 if (
v.userType() == QMetaType::QPixmap && isPixmap) {
3177 if (qvariant_cast<QPixmap>(
v).cacheKey() == cacheKey)
3183 url =
it.key().toString();
3193 cachedResources.
insert(priv->cachedResources);
3200 emitAttribute(
"background",
url);
3204 emitAttribute(
"bgcolor", colorValue(
brush.color()));
3207 const qint64 cacheKey = isPixmap ?
brush.texture().cacheKey() :
brush.textureImage().cacheKey();
3209 const QString url = findUrlForImage(doc, cacheKey, isPixmap);
3212 emitAttribute(
"background",
url);
3226 emitFrameStyle(
format, TableFrame);
3228 emitAlignment(
format.alignment());
3229 emitTextLength(
"width",
format.width());
3236 emitBackgroundAttribute(
format);
3240 const int rows =
table->rows();
3241 const int columns =
table->columns();
3245 columnWidths.
resize(columns);
3251 for (
int i = 0;
i < columns; ++
i)
3252 widthEmittedForColumn[
i] =
false;
3254 const int headerRowCount = qMin(
format.headerRowCount(), rows);
3255 if (headerRowCount > 0)
3261 for (
int col = 0; col < columns; ++col) {
3268 if (cell.
column() != col)
3273 if (!widthEmittedForColumn[col] && cell.
columnSpan() == 1) {
3274 emitTextLength(
"width", columnWidths.
at(col));
3275 widthEmittedForColumn[col] =
true;
3285 emitBackgroundAttribute(cellFormat);
3311 defaultCharFormat.
merge(temp);
3355 emitFrame(cell.
begin());
3359 defaultCharFormat = oldDefaultCharFormat;
3363 if (headerRowCount > 0 &&
row == headerRowCount - 1)
3372 if (!frameIt.
atEnd()) {
3383 !
it.atEnd(); ++
it) {
3390 }
else if (
it.currentBlock().isValid()) {
3391 emitBlock(
it.currentBlock());
3396 void QTextHtmlExporter::emitTextFrame(
const QTextFrame *
f)
3398 FrameType frameType =
f->parentFrame() ? TextFrame : RootFrame;
3406 emitFrameStyle(
format, frameType);
3408 emitTextLength(
"width",
format.width());
3409 emitTextLength(
"height",
format.height());
3412 if (frameType != RootFrame)
3413 emitBackgroundAttribute(
format);
3416 html +=
QLatin1String(
"\n<tr>\n<td style=\"border: none;\">");
3417 emitFrame(
f->begin());
3424 html += styleAttribute;
3425 const int originalHtmlLength = html.
length();
3427 if (frameType == TextFrame)
3429 else if (frameType == RootFrame)
3434 emitFloatStyle(
format.position(), OmitStyleTag);
3435 emitPageBreakPolicy(
format.pageBreakPolicy());
3439 html += colorValue(
format.borderBrush().color());
3444 emitBorderStyle(
format.borderStyle());
3459 if (html.
length() == originalHtmlLength)
3460 html.
chop(styleAttribute.size());
3475 #ifndef QT_NO_TEXTHTMLPARSER
3489 #if QT_CONFIG(textmarkdownwriter)
3490 QString QTextDocument::toMarkdown(QTextDocument::MarkdownFeatures features)
const
3495 if (
w.writeAll(
this))
3531 #if QT_CONFIG(textmarkdownreader)
3532 void QTextDocument::setMarkdown(
const QString &markdown, QTextDocument::MarkdownFeatures features)
3544 return d->formatCollection()->formats;
3556 #include "moc_qtextdocument.cpp"
small capitals from c petite p scientific i
[1]
const QByteArray payload("Qt rocks!")
The QAbstractTextDocumentLayout class is an abstract base class used to implement custom layouts for ...
virtual int pageCount() const =0
virtual void draw(QPainter *painter, const PaintContext &context)=0
QPaintDevice * paintDevice() const
virtual QSizeF documentSize() const =0
The QBrush class defines the fill pattern of shapes drawn by QPainter.
const QColor & color() const
Qt::BrushStyle style() const
The QByteArray class provides an array of bytes.
The QChar class provides a 16-bit Unicode character.
constexpr bool isLetterOrNumber() const noexcept
@ ObjectReplacementCharacter
constexpr char16_t unicode() const noexcept
constexpr bool isSpace() const noexcept
The QColor class provides colors based on RGB, HSV or CMYK values.
QString name(NameFormat format=HexRgb) const
The QFile class provides an interface for reading from and writing to files.
The QFileInfo class provides system-independent file information.
QString absolutePath() const
The QFont class specifies a query for a font used for drawing text.
The QFontMetrics class provides font metrics information.
int horizontalAdvance(const QString &, int len=-1) const
The QImage class provides a hardware-independent image representation that allows direct access to th...
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.
QList< T > & fill(parameter_type t, qsizetype size=-1)
bool isEmpty() const noexcept
const_reference at(qsizetype i) const noexcept
qsizetype count() const noexcept
void resize(qsizetype size)
iterator insert(const Key &key, const T &value)
const_iterator constBegin() const
const_iterator constEnd() const
The QMarginsF class defines the four margins of a rectangle.
constexpr void setLeft(qreal aleft) noexcept
The QObject class is the base class of all Qt objects.
QMarginsF margins() const
The QPageRanges class represents a collection of page ranges. \inmodule QtGui.
bool contains(int pageNumber) const
The QPagedPaintDevice class represents a paint device that supports multiple pages.
virtual bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units=QPageLayout::Millimeter)
QPageRanges pageRanges() const
QPageLayout pageLayout() const
The QPainter class performs low-level painting on widgets and other paint devices.
void setClipping(bool enable)
void setClipRect(const QRectF &, Qt::ClipOperation op=Qt::ReplaceClip)
QFontMetrics fontMetrics() const
void setFont(const QFont &f)
void drawText(const QPointF &p, const QString &s)
void translate(const QPointF &offset)
void setColor(ColorGroup cg, ColorRole cr, const QColor &color)
The QPixmap class is an off-screen image representation that can be used as a paint device.
bool loadFromData(const uchar *buf, uint len, const char *format=nullptr, Qt::ImageConversionFlags flags=Qt::AutoColor)
The QPointF class defines a point in the plane using floating point precision.
constexpr qreal x() const noexcept
constexpr qreal y() const noexcept
bool isNull() const noexcept
The QRectF class defines a finite rectangle in the plane using floating point precision.
The QRegularExpression class provides pattern matching using regular expressions.
PatternOptions patternOptions() const
The QRegularExpressionMatch class provides the results of a matching a QRegularExpression against a s...
qsizetype capturedLength(int nth=0) const
The QScopedPointer class stores a pointer to a dynamically allocated object, and deletes it upon dest...
void reset(T *other=nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval< T * >())))
The QSizeF class defines the size of a two-dimensional object using floating point precision.
constexpr qreal & rwidth() noexcept
constexpr void setHeight(qreal h) noexcept
constexpr qreal & rheight() noexcept
constexpr void setWidth(qreal w) noexcept
constexpr qreal width() const noexcept
constexpr qreal height() const noexcept
The QString class provides a Unicode character string.
QString & prepend(QChar c)
qsizetype lastIndexOf(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
QString & replace(qsizetype i, qsizetype len, QChar after)
void reserve(qsizetype size)
static QString fromLatin1(QByteArrayView ba)
QString mid(qsizetype position, qsizetype n=-1) const
const QChar at(qsizetype i) const
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=QLatin1Char(' ')) const
static QString number(int, int base=10)
static QString static QString qsizetype indexOf(QChar c, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
QString toHtmlEscaped() const
The QStringList class provides a list of strings.
The QStringView class provides a unified view on UTF-16 strings with a read-only subset of the QStrin...
The QTextBlock::iterator class provides an iterator for reading the contents of a QTextBlock....
The QTextBlockFormat class provides formatting information for blocks of text in a QTextDocument....
bool nonBreakableLines() const
The QTextBlock class provides a container for text fragments in a QTextDocument. \inmodule QtGui.
QTextList * textList() const
The QTextCharFormat class provides formatting information for characters in a QTextDocument....
qreal fontLetterSpacing() const
QStringList anchorNames() const
qreal fontPointSize() const
bool fontStrikeOut() const
void setVerticalAlignment(VerticalAlignment alignment)
qreal fontWordSpacing() const
bool fontOverline() const
VerticalAlignment verticalAlignment() const
QFont::SpacingType fontLetterSpacingType() const
bool fontUnderline() const
void setFont(const QFont &font, FontPropertiesInheritanceBehavior behavior=FontPropertiesAll)
The QTextCursor class offers an API to access and modify QTextDocuments.
void setBlockCharFormat(const QTextCharFormat &format)
QTextBlockFormat blockFormat() const
QTextCharFormat blockCharFormat() const
void insertFragment(const QTextDocumentFragment &fragment)
void setBlockFormat(const QTextBlockFormat &format)
void insertText(const QString &text)
static QTextCursor fromPosition(QTextDocumentPrivate *d, int pos)
The QTextDocumentFragment class represents a piece of formatted text from a QTextDocument.
The QTextDocument class holds formatted text.
void setModified(bool m=true)
QString defaultStyleSheet
QTextDocument * clone(QObject *parent=nullptr) const
void setDefaultCursorMoveStyle(Qt::CursorMoveStyle style)
void setSuperScriptBaseline(qreal baseline)
void setBaselineOffset(qreal baseline)
void setIndentWidth(qreal width)
QTextBlock findBlockByLineNumber(int blockNumber) const
int maximumBlockCount
Specifies the limit for blocks in the document.
void setHtml(const QString &html)
QTextFrame * frameAt(int pos) const
qreal baselineOffset() const
void setDefaultTextOption(const QTextOption &option)
int availableRedoSteps() const
void setResourceProvider(const ResourceProvider &provider)
QList< QTextFormat > allFormats() const
bool isRedoAvailable() const
QFont defaultFont
the default font used to display the document's text
QTextBlock findBlockByNumber(int blockNumber) const
int availableUndoSteps() const
int blockCount
the number of text blocks in the document.
QAbstractTextDocumentLayout * documentLayout() const
QString toRawText() const
bool useDesignMetrics
whether the document uses design metrics of fonts to improve the accuracy of text layout
QSizeF size
the actual size of the document. This is equivalent to documentLayout()->documentSize();
QSizeF pageSize
the page size that should be used for laying out the document
void appendUndoItem(QAbstractUndoItem *)
QTextObject * objectForFormat(const QTextFormat &) const
bool isUndoRedoEnabled() const
void baseUrlChanged(const QUrl &url)
bool isUndoAvailable() const
QTextOption defaultTextOption() const
the default text option will be set on all \l{QTextLayout}s in the document.
void print(QPagedPaintDevice *printer) const
QVariant resource(int type, const QUrl &name) const
void setDefaultFont(const QFont &font)
QChar characterAt(int pos) const
void setPageSize(const QSizeF &size)
QTextDocument(QObject *parent=nullptr)
QTextDocument::ResourceProvider resourceProvider() const
void setDefaultStyleSheet(const QString &sheet)
void setUndoRedoEnabled(bool enable)
QUrl baseUrl
the base URL used to resolve relative resource URLs within the document.
QString toPlainText() const
virtual Q_INVOKABLE QVariant loadResource(int type, const QUrl &name)
QTextObject * object(int objectIndex) const
void clearUndoRedoStacks(Stacks historyToClear=UndoAndRedoStacks)
QTextCursor find(const QString &subString, int from=0, FindFlags options=FindFlags()) const
void setDocumentMargin(qreal margin)
QTextBlock findBlock(int pos) const
qreal subScriptBaseline() const
QString metaInformation(MetaInformation info) const
Qt::CursorMoveStyle defaultCursorMoveStyle() const
QTextBlock firstBlock() const
static void setDefaultResourceProvider(const ResourceProvider &provider)
void setPlainText(const QString &text)
void setMaximumBlockCount(int maximum)
QTextFrame * rootFrame() const
void setDocumentLayout(QAbstractTextDocumentLayout *layout)
void setMetaInformation(MetaInformation info, const QString &)
qreal superScriptBaseline() const
static QTextDocument::ResourceProvider defaultResourceProvider()
void setBaseUrl(const QUrl &url)
QTextBlock lastBlock() const
void addResource(int type, const QUrl &name, const QVariant &resource)
void setSubScriptBaseline(qreal baseline)
virtual QTextObject * createObject(const QTextFormat &f)
std::function< QVariant(const QUrl &)> ResourceProvider
void markContentsDirty(int from, int length)
void setUseDesignMetrics(bool b)
void setTextWidth(qreal width)
void drawContents(QPainter *painter, const QRectF &rect=QRectF())
int characterCount() const
QCss::StyleSheet parsedDefaultStyleSheet
FragmentMap::ConstIterator FragmentIterator
static const QTextDocumentPrivate * get(const QTextDocument *document)
FragmentIterator find(int pos) const
QTextOption defaultTextOption
void mergeCachedResources(const QTextDocumentPrivate *priv)
void setDefaultFont(const QFont &f)
The QTextFormat class provides formatting information for a QTextDocument. \inmodule QtGui.
QTextCharFormat toCharFormat() const
QBrush background() const
QString stringProperty(int propertyId) const
@ TableCellBottomBorderStyle
@ TableCellTopBorderStyle
@ TableCellBottomBorderBrush
@ TableCellRightBorderStyle
@ BlockTrailingHorizontalRulerWidth
@ TableCellTopBorderBrush
@ TableCellRightBorderBrush
@ TableCellLeftBorderStyle
@ TableCellLeftBorderBrush
QTextLength lengthProperty(int propertyId) const
int intProperty(int propertyId) const
void setProperty(int propertyId, const QVariant &value)
QTextImageFormat toImageFormat() const
QMap< int, QVariant > properties() const
QTextTableCellFormat toTableCellFormat() const
bool hasProperty(int propertyId) const
void clearProperty(int propertyId)
void merge(const QTextFormat &other)
QVariant property(int propertyId) const
QBrush foreground() const
The QTextFragment class holds a piece of text in a QTextDocument with a single QTextCharFormat....
QTextCharFormat charFormat() const
The iterator class provides an iterator for reading the contents of a QTextFrame.
QTextFrame * parentFrame() const
QTextFrame * currentFrame() const
Q_GUI_EXPORT QTextBlock currentBlock() const
The QTextFrameFormat class provides formatting information for frames in a QTextDocument....
QBrush borderBrush() const
void setTopMargin(qreal margin)
void setLeftMargin(qreal margin)
void setBottomMargin(qreal margin)
BorderStyle borderStyle() const
void setRightMargin(qreal margin)
void setMargin(qreal margin)
The QTextFrame class represents a frame in a QTextDocument. \inmodule QtGui.
void setFrameFormat(const QTextFrameFormat &format)
QTextFrameFormat frameFormat() const
QString toHtml(ExportMode mode=ExportEntireDocument)
QTextHtmlExporter(const QTextDocument *_doc)
static int lookupElement(const QString &element)
The QTextImageFormat class provides formatting information for images in a QTextDocument....
The QTextLength class encapsulates the different types of length used in a QTextDocument....
The QTextListFormat class provides formatting information for lists in a QTextDocument....
The QTextList class provides a decorated list of items in a QTextDocument. \inmodule QtGui.
int itemNumber(const QTextBlock &) const
QTextListFormat format() const
void import(QTextDocument *doc, const QString &markdown)
The QTextObject class is a base class for different kinds of objects that can group parts of a QTextD...
The QTextOption class provides a description of general rich text properties. \inmodule QtGui.
The QTextStream class provides a convenient interface for reading and writing text.
The QTextTableCellFormat class provides formatting information for table cells in a QTextDocument....
QBrush leftBorderBrush() const
QTextFrameFormat::BorderStyle bottomBorderStyle() const
QTextFrameFormat::BorderStyle rightBorderStyle() const
QBrush rightBorderBrush() const
qreal rightBorder() const
QBrush topBorderBrush() const
qreal bottomBorder() const
qreal leftPadding() const
qreal rightPadding() const
QBrush bottomBorderBrush() const
QTextFrameFormat::BorderStyle leftBorderStyle() const
qreal bottomPadding() const
QTextFrameFormat::BorderStyle topBorderStyle() const
The QTextTableCell class represents the properties of a cell in a QTextTable. \inmodule QtGui.
QTextCharFormat format() const
QTextFrame::iterator begin() const
The QTextTableFormat class provides formatting information for tables in a QTextDocument....
The QTextTable class represents a table in a QTextDocument. \inmodule QtGui.
static QThread * currentThread()
The QUrl class provides a convenient interface for working with URLs.
static QUrl fromLocalFile(const QString &localfile)
QUrl resolved(const QUrl &relative) const
void setScheme(const QString &scheme)
QString toString(FormattingOptions options=FormattingOptions(PrettyDecoded)) const
QString toLocalFile() const
The QVariant class acts like a union for the most common Qt data types.
union Alignment_ Alignment
backing_store_ptr info
[4]
std::string toLower(std::string const &s)
@ StyleSheetOrigin_UserAgent
Q_GUI_EXPORT QString convertFromPlainText(const QString &plain, WhiteSpaceMode mode=WhiteSpacePre)
Q_GUI_EXPORT bool mightBeRichText(const QString &)
#define Q_DECL_CONST_FUNCTION
QT_BEGIN_NAMESPACE Q_CORE_EXPORT bool qDecodeDataUrl(const QUrl &uri, QString &mimeType, QByteArray &payload)
typedef QByteArray(EGLAPIENTRYP PFNQGSGETDISPLAYSPROC)()
EGLOutputLayerEXT EGLint EGLAttrib value
EGLOutputLayerEXT EGLint attribute
int qRound(qfloat16 d) noexcept
Q_GUI_EXPORT int qt_defaultDpiX()
Q_GUI_EXPORT int qt_defaultDpiY()
QT_END_INCLUDE_NAMESPACE typedef double qreal
#define Q_ARG(type, data)
#define Q_RETURN_ARG(type, data)
GLenum GLuint GLenum GLsizei length
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLfloat GLfloat GLfloat w
[0]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLdouble GLdouble GLdouble GLdouble top
GLenum GLuint GLsizei const GLenum * props
GLenum GLuint GLintptr offset
GLint GLsizei GLsizei GLenum format
GLenum GLenum GLsizei void * row
GLenum GLenum GLsizei void * table
GLsizei const GLchar *const * string
[0]
#define Q_ASSERT_X(cond, x, msg)
QT_BEGIN_NAMESPACE Q_CORE_EXPORT Q_DECL_CONST_FUNCTION unsigned int qt_int_sqrt(unsigned int n)
bool qHasPixmapTexture(const QBrush &brush)
#define QTextBeginningOfFrame
file open(QIODevice::ReadOnly)
QFileInfo fi("c:/temp/foo")
[newstuff]
QUrl url("http://www.example.com/List of holidays.xml")
[0]
The QAbstractTextDocumentLayout::PaintContext class is a convenience class defining the parameters us...
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
void compare(Input input, FnUnderTest fn_under_test, const QByteArray &output)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent
XmlOutput::xml_output tag(const QString &name)