Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QTextHtmlParser Class Reference

#include <qtexthtmlparser_p.h>

+ Inheritance diagram for QTextHtmlParser:
+ Collaboration diagram for QTextHtmlParser:

Public Types

enum  Margin { MarginTop , MarginRight , MarginBottom , MarginLeft }
 

Public Member Functions

 ~QTextHtmlParser ()
 
const QTextHtmlParserNodeat (int i) const
 
QTextHtmlParserNodeoperator[] (int i)
 
int count () const
 
int last () const
 
int depth (int i) const
 
int topMargin (int i) const
 
int bottomMargin (int i) const
 
int leftMargin (int i) const
 
int rightMargin (int i) const
 
int topPadding (int i) const
 
int bottomPadding (int i) const
 
int leftPadding (int i) const
 
int rightPadding (int i) const
 
qreal tableCellBorder (int i, int edge) const
 
QTextFrameFormat::BorderStyle tableCellBorderStyle (int i, int edge) const
 
QBrush tableCellBorderBrush (int i, int edge) const
 
void dumpHtml ()
 
void parse (const QString &text, const QTextDocument *resourceProvider)
 

Static Public Member Functions

static int lookupElement (QStringView element)
 
static Q_GUI_EXPORT QString parseEntity (QStringView entity)
 

Protected Member Functions

QTextHtmlParserNodenewNode (int parent)
 
void parse ()
 
void parseTag ()
 
void parseCloseTag ()
 
void parseExclamationTag ()
 
QString parseEntity ()
 
QString parseWord ()
 
QTextHtmlParserNoderesolveParent ()
 
void resolveNode ()
 
QStringList parseAttributes ()
 
void applyAttributes (const QStringList &attributes)
 
void eatSpace ()
 
bool hasPrefix (QChar c, int lookahead=0) const
 
int margin (int i, int mar) const
 
bool nodeIsChildOf (int i, QTextHTMLElements id) const
 

Protected Attributes

QList< QTextHtmlParserNode * > nodes
 
QString txt
 
int pos
 
int len
 
bool textEditMode
 
const QTextDocumentresourceProvider
 

Detailed Description

Definition at line 242 of file qtexthtmlparser_p.h.

Member Enumeration Documentation

◆ Margin

Enumerator
MarginTop 
MarginRight 
MarginBottom 
MarginLeft 

Definition at line 245 of file qtexthtmlparser_p.h.

Constructor & Destructor Documentation

◆ ~QTextHtmlParser()

QTextHtmlParser::~QTextHtmlParser ( )
inline

Definition at line 251 of file qtexthtmlparser_p.h.

References nodes, and qDeleteAll().

+ Here is the call graph for this function:

Member Function Documentation

◆ applyAttributes()

void QTextHtmlParser::applyAttributes ( const QStringList & attributes)
protected

Definition at line 1612 of file qtexthtmlparser.cpp.

References Qt::AlignAbsolute, QTextCharFormat::AlignBottom, Qt::AlignHCenter, Qt::AlignJustify, Qt::AlignLeft, QTextBlockFormat::alignment(), QTextCharFormat::AlignMiddle, Qt::AlignRight, QTextCharFormat::AlignTop, QTextHtmlParserNode::applyBackgroundImage(), QTextFormat::BlockCodeLanguage, QTextHtmlParserNode::blockFormat, QTextHtmlParserNode::borderBrush, QTextHtmlParserNode::charFormat, QTextBlockFormat::Checked, QTextHtmlParserNode::cssFloat, QTextFrameFormat::FloatLeft, QTextFrameFormat::FloatRight, QTextFormat::FontSizeAdjustment, QColor::fromString(), QTextHtmlParserNode::hasOwnListStyle, QTextHtmlParserNode::height, Html_a, Html_body, Html_font, Html_hr, Html_img, Html_li, Html_link, Html_meta, Html_ol, Html_pre, Html_table, Html_td, Html_th, Html_tr, Html_ul, i, QTextHtmlParserNode::id, QTextHtmlParserNode::imageAlt, QTextHtmlParserNode::imageHeight, QTextHtmlParserNode::imageName, QTextHtmlParserNode::imageWidth, QTextDocument::isEmpty(), QList< T >::last(), Qt::LeftToRight, QTextListFormat::ListCircle, QTextListFormat::ListDecimal, QTextListFormat::ListDisc, QTextListFormat::ListLowerAlpha, QTextListFormat::ListLowerRoman, QTextListFormat::ListSquare, QTextHtmlParserNode::listStart, QTextHtmlParserNode::listStyle, QTextListFormat::ListStyleUndefined, QTextListFormat::ListUpperAlpha, QTextListFormat::ListUpperRoman, nodes, QTextHtmlParserNode::parseStyleAttribute(), qBound(), qMax(), qWarning, resourceProvider, Qt::RightToLeft, QTextBlockFormat::setAlignment(), QTextCharFormat::setAnchor(), QTextCharFormat::setAnchorHref(), QTextCharFormat::setAnchorNames(), QTextFormat::setBackground(), setFloatAttribute(), QTextCharFormat::setFontFamilies(), QTextFormat::setForeground(), setIntAttribute(), QTextFormat::setLayoutDirection(), QTextBlockFormat::setMarker(), QTextFormat::setProperty(), QTextCharFormat::setToolTip(), QTextCharFormat::setVerticalAlignment(), setWidthAttribute(), QTextHtmlParserNode::tableBorder, QTextHtmlParserNode::tableCellColSpan, QTextHtmlParserNode::tableCellPadding, QTextHtmlParserNode::tableCellRowSpan, QTextHtmlParserNode::tableCellSpacing, QTextHtmlParserNode::text, textEditMode, QTextBlockFormat::Unchecked, and QTextHtmlParserNode::width.

Referenced by parseTag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ at()

const QTextHtmlParserNode & QTextHtmlParser::at ( int i) const
inline

Definition at line 256 of file qtexthtmlparser_p.h.

References QList< T >::at(), i, and nodes.

Referenced by QTextHtmlStyleSelector::attributeValue(), QTextHtmlStyleSelector::hasAttributes(), QTextHtmlParserNode::isNestedList(), QTextHtmlStyleSelector::nodeNames(), QTextHtmlStyleSelector::parentNode(), and QTextHtmlStyleSelector::previousSiblingNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bottomMargin()

int QTextHtmlParser::bottomMargin ( int i) const

Definition at line 588 of file qtexthtmlparser.cpp.

References at, i, and MarginBottom.

◆ bottomPadding()

int QTextHtmlParser::bottomPadding ( int i) const
inline

Definition at line 267 of file qtexthtmlparser_p.h.

References at, i, and MarginBottom.

◆ count()

int QTextHtmlParser::count ( ) const
inline

Definition at line 258 of file qtexthtmlparser_p.h.

References nodes, and QList< T >::size().

Referenced by dumpHtml(), QTextHtmlImporter::import(), and newNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ depth()

int QTextHtmlParser::depth ( int i) const

Definition at line 553 of file qtexthtmlparser.cpp.

References at, i, and QObject::parent().

+ Here is the call graph for this function:

◆ dumpHtml()

void QTextHtmlParser::dumpHtml ( )

Definition at line 475 of file qtexthtmlparser.cpp.

References at, count(), i, qDebug, qPrintable, quoteNewline(), tag, and text.

+ Here is the call graph for this function:

◆ eatSpace()

void QTextHtmlParser::eatSpace ( )
protected

Definition at line 595 of file qtexthtmlparser.cpp.

References QString::at(), pos, and txt.

Referenced by parseAttributes(), and parseTag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasPrefix()

bool QTextHtmlParser::hasPrefix ( QChar c,
int lookahead = 0 ) const
inlineprotected

Definition at line 302 of file qtexthtmlparser_p.h.

References QString::at(), pos, and txt.

Referenced by parseAttributes(), parseExclamationTag(), parseTag(), and parseWord().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ last()

int QTextHtmlParser::last ( ) const
inline

Definition at line 259 of file qtexthtmlparser_p.h.

References nodes, and QList< T >::size().

Referenced by parseCloseTag(), and parseTag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ leftMargin()

int QTextHtmlParser::leftMargin ( int i) const
inline

Definition at line 263 of file qtexthtmlparser_p.h.

References i, margin(), and MarginLeft.

+ Here is the call graph for this function:

◆ leftPadding()

int QTextHtmlParser::leftPadding ( int i) const
inline

Definition at line 268 of file qtexthtmlparser_p.h.

References at, i, and MarginLeft.

◆ lookupElement()

int QTextHtmlParser::lookupElement ( QStringView element)
static

Definition at line 436 of file qtexthtmlparser.cpp.

References QTextHtmlElement::id, and lookupElementHelper().

Referenced by mightBeRichTextImpl().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ margin()

int QTextHtmlParser::margin ( int i,
int mar ) const
protected

Definition at line 563 of file qtexthtmlparser.cpp.

References at, Html_table, i, QTextHtmlParserNode::id, QTextHtmlParserNode::isBlock(), QTextHtmlParserNode::isTableCell(), QTextHtmlParserNode::margin, MarginLeft, MarginRight, and QTextHtmlParserNode::parent.

Referenced by leftMargin(), and rightMargin().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ newNode()

QTextHtmlParserNode * QTextHtmlParser::newNode ( int parent)
protected

Definition at line 484 of file qtexthtmlparser.cpp.

References QList< T >::append(), at, QString::clear(), count(), QTextHtmlElement::DisplayInline, Html_unknown, QTextHtmlParserNode::id, QList< T >::last(), newNode(), nodes, QObject::parent(), QTextHtmlParserNode::parent, QList< T >::size(), QTextHtmlParserNode::tag, and QTextHtmlParserNode::text.

Referenced by newNode(), parseCloseTag(), and parseTag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nodeIsChildOf()

bool QTextHtmlParser::nodeIsChildOf ( int i,
QTextHTMLElements id ) const
protected

Definition at line 2199 of file qtexthtmlparser.cpp.

References at, i, and QObject::parent().

+ Here is the call graph for this function:

◆ operator[]()

QTextHtmlParserNode & QTextHtmlParser::operator[] ( int i)
inline

Definition at line 257 of file qtexthtmlparser_p.h.

References i, and nodes.

◆ parse() [1/2]

void QTextHtmlParser::parse ( )
protected

Definition at line 601 of file qtexthtmlparser.cpp.

References QString::at(), QList< T >::last(), nodes, parseEntity(), parseTag(), pos, QTextHtmlParserNode::text, and txt.

Referenced by QTextHtmlImporter::QTextHtmlImporter(), and parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse() [2/2]

void QTextHtmlParser::parse ( const QString & text,
const QTextDocument * resourceProvider )

Definition at line 539 of file qtexthtmlparser.cpp.

References QList< T >::append(), QList< T >::clear(), nodes, parse(), pos, qDeleteAll(), resourceProvider, QString::size(), text, textEditMode, and txt.

+ Here is the call graph for this function:

◆ parseAttributes()

QStringList QTextHtmlParser::parseAttributes ( )
protected

Definition at line 1586 of file qtexthtmlparser.cpp.

References attrs, eatSpace(), hasPrefix(), parseWord(), pos, and QString::toLower().

Referenced by parseTag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseCloseTag()

void QTextHtmlParser::parseCloseTag ( )
protected

Definition at line 707 of file qtexthtmlparser.cpp.

References QString::at(), at, QString::endsWith(), last(), newNode(), nodes, QObject::parent(), parseWord(), pos, resolveNode(), tag, text, QString::toLower(), QString::trimmed(), txt, QTextHtmlParserNode::WhiteSpacePre, QTextHtmlParserNode::WhiteSpacePreLine, and QTextHtmlParserNode::WhiteSpacePreWrap.

Referenced by parseTag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseEntity() [1/2]

QString QTextHtmlParser::parseEntity ( )
protected

Definition at line 796 of file qtexthtmlparser.cpp.

References QString::at(), error, QStringView::mid(), parseEntity(), pos, and txt.

Referenced by parse(), parseEntity(), QQuickStyledTextPrivate::parseEntity(), and parseWord().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseEntity() [2/2]

QString QTextHtmlParser::parseEntity ( QStringView entity)
static

Definition at line 768 of file qtexthtmlparser.cpp.

References base, ok, resolveEntity(), QStringView::toString(), and windowsLatin1ExtendedCharacters.

+ Here is the call graph for this function:

◆ parseExclamationTag()

void QTextHtmlParser::parseExclamationTag ( )
protected

Definition at line 750 of file qtexthtmlparser.cpp.

References QString::at(), hasPrefix(), QString::indexOf(), len, pos, and txt.

Referenced by parseTag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseTag()

◆ parseWord()

QString QTextHtmlParser::parseWord ( )
protected

Definition at line 822 of file qtexthtmlparser.cpp.

References QString::at(), hasPrefix(), parseEntity(), pos, QString::size(), and txt.

Referenced by parseAttributes(), parseCloseTag(), and parseTag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resolveNode()

void QTextHtmlParser::resolveNode ( )
protected

Definition at line 962 of file qtexthtmlparser.cpp.

References QList< T >::at(), QTextHtmlParserNode::initializeProperties(), QList< T >::last(), nodes, and QTextHtmlParserNode::parent.

Referenced by parseCloseTag(), and parseTag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resolveParent()

QTextHtmlParserNode * QTextHtmlParser::resolveParent ( )
protected

Definition at line 864 of file qtexthtmlparser.cpp.

References QTextHtmlParserNode::allowedInContext(), QList< T >::append(), at, Html_p, Html_table, Html_td, Html_tr, QTextHtmlParserNode::id, QList< T >::insert(), QTextHtmlParserNode::isNotSelfNesting(), QList< T >::last(), nodes, QObject::parent(), QTextHtmlParserNode::parent, and QList< T >::size().

Referenced by parseTag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rightMargin()

int QTextHtmlParser::rightMargin ( int i) const
inline

Definition at line 264 of file qtexthtmlparser_p.h.

References i, margin(), and MarginRight.

+ Here is the call graph for this function:

◆ rightPadding()

int QTextHtmlParser::rightPadding ( int i) const
inline

Definition at line 269 of file qtexthtmlparser_p.h.

References at, i, and MarginRight.

◆ tableCellBorder()

qreal QTextHtmlParser::tableCellBorder ( int i,
int edge ) const
inline

Definition at line 271 of file qtexthtmlparser_p.h.

References at, and i.

◆ tableCellBorderBrush()

QBrush QTextHtmlParser::tableCellBorderBrush ( int i,
int edge ) const
inline

Definition at line 273 of file qtexthtmlparser_p.h.

References at, and i.

◆ tableCellBorderStyle()

QTextFrameFormat::BorderStyle QTextHtmlParser::tableCellBorderStyle ( int i,
int edge ) const
inline

Definition at line 272 of file qtexthtmlparser_p.h.

References at, and i.

◆ topMargin()

int QTextHtmlParser::topMargin ( int i) const

Definition at line 581 of file qtexthtmlparser.cpp.

References at, i, and MarginTop.

◆ topPadding()

int QTextHtmlParser::topPadding ( int i) const
inline

Definition at line 266 of file qtexthtmlparser_p.h.

References at, i, and MarginTop.

Member Data Documentation

◆ len

int QTextHtmlParser::len
protected

Definition at line 287 of file qtexthtmlparser_p.h.

Referenced by parseExclamationTag().

◆ nodes

◆ pos

int QTextHtmlParser::pos
protected

◆ resourceProvider

const QTextDocument* QTextHtmlParser::resourceProvider
protected

◆ textEditMode

bool QTextHtmlParser::textEditMode
protected

Definition at line 289 of file qtexthtmlparser_p.h.

Referenced by applyAttributes(), QTextHtmlImporter::import(), parse(), and parseTag().

◆ txt

QString QTextHtmlParser::txt
protected

The documentation for this class was generated from the following files: