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
qtextdocumentlayout.cpp File Reference

(7f48c79627663f0777df9c10d06202aea5bedac3)

#include "qtextdocumentlayout_p.h"
#include "qtextdocument_p.h"
#include "qtextimagehandler_p.h"
#include "qtexttable.h"
#include "qtextlist.h"
#include "qtextengine_p.h"
#include "private/qguiapplication_p.h"
#include "qabstracttextdocumentlayout_p.h"
#include "qcssparser_p.h"
#include <qpainter.h>
#include <qmath.h>
#include <qrect.h>
#include <qpalette.h>
#include <qdebug.h>
#include <qvarlengtharray.h>
#include <limits.h>
#include <qbasictimer.h>
#include "private/qfunctions_p.h"
#include <qloggingcategory.h>
#include <QtCore/qpointer.h>
#include <algorithm>
#include "moc_qtextdocumentlayout_p.cpp"
+ Include dependency graph for qtextdocumentlayout.cpp:

Go to the source code of this file.

Classes

class  QTextFrameData
 
struct  QTextLayoutStruct
 
struct  EdgeData
 
class  QTextTableData
 
struct  QCheckPoint
 
class  QTextDocumentLayoutPrivate
 
struct  BorderPaginator
 

Functions

static EdgeData axisEdgeData (QTextTable *table, const QTextTableData *td, const QTextTableCell &cell, QCss::Edge edge)
 
static QTextFrameDatacreateData (QTextFrame *f)
 
static QTextFrameDatadata (QTextFrame *f)
 
static bool isFrameFromInlineObject (QTextFrame *f)
 
static bool isEmptyBlockBeforeTable (const QTextBlock &block, const QTextBlockFormat &format, const QTextFrame::Iterator &nextIt)
 
static bool isEmptyBlockBeforeTable (const QTextFrame::Iterator &it)
 
static bool isEmptyBlockAfterTable (const QTextBlock &block, const QTextFrame *previousFrame)
 
static bool isLineSeparatorBlockAfterTable (const QTextBlock &block, const QTextFrame *previousFrame)
 
 Q_DECLARE_TYPEINFO (QCheckPoint, Q_PRIMITIVE_TYPE)
 
static bool operator< (const QCheckPoint &checkPoint, QFixed y)
 
static bool operator< (const QCheckPoint &checkPoint, int pos)
 
static void fillBackground (QPainter *p, const QRectF &rect, QBrush brush, const QPointF &origin, const QRectF &gradientRect=QRectF())
 
static void adjustContextSelectionsForCell (QAbstractTextDocumentLayout::PaintContext &cell_context, const QTextTableCell &cell, int r, int c, const int *selectedTableCells)
 
static bool cellClipTest (QTextTable *table, QTextTableData *td, const QAbstractTextDocumentLayout::PaintContext &cell_context, const QTextTableCell &cell, QRectF cellRect)
 
static QTextFormat::Property borderPropertyForEdge (QCss::Edge edge)
 
static QTextFormat::Property borderStylePropertyForEdge (QCss::Edge edge)
 
static QCss::Edge adjacentEdge (QCss::Edge edge)
 
static bool isSameAxis (QCss::Edge e1, QCss::Edge e2)
 
static bool isVerticalAxis (QCss::Edge e)
 
static QTextTableCell adjacentCell (QTextTable *table, const QTextTableCell &cell, QCss::Edge edge)
 
static bool sharesAxis (const QTextTableCell &cell, QCss::Edge edge, const QTextTableCell &competingCell, QCss::Edge competingCellEdge)
 
static EdgeData cellEdgeData (QTextTable *table, const QTextTableData *td, const QTextTableCell &cell, QCss::Edge edge)
 
static void checkJoinedEdge (QTextTable *table, const QTextTableData *td, const QTextTableCell &cell, QCss::Edge competingEdge, const EdgeData &edgeData, bool couldHaveContinuation, EdgeData *maxCompetingEdgeData, EdgeData *maxOrthogonalEdgeData)
 
static qreal collapseOffset (const QTextDocumentLayoutPrivate *p, const EdgeData &w)
 
static double prioritizedEdgeAnchorOffset (const QTextDocumentLayoutPrivate *p, QTextTable *table, const QTextTableData *td, const QTextTableCell &cell, const EdgeData &edgeData, QCss::Edge orthogonalEdge, bool couldHaveContinuation, bool ignoreEdgesAbove)
 
static void drawCellBorder (const QTextDocumentLayoutPrivate *p, QPainter *painter, QTextTable *table, const QTextTableData *td, const QTextTableCell &cell, const QRectF &borderRect, QCss::Edge edge, int forceHeaderRow, bool adjustTopAnchor, bool adjustBottomAnchor, bool ignoreEdgesAbove)
 
static QFixed flowPosition (const QTextFrame::iterator &it)
 
static QFixed firstChildPos (const QTextFrame *f)
 
static void findWidestOutermostBorder (QTextTable *table, QTextTableData *td, const QTextTableCell &cell, QCss::Edge edge, qreal *outerBorders)
 
static void getLineHeightParams (const QTextBlockFormat &blockFormat, const QTextLine &line, qreal scaling, QFixed *lineAdjustment, QFixed *lineBreakHeight, QFixed *lineHeight, QFixed *lineBottom)
 
static void markFrames (QTextFrame *current, int from, int oldLength, int length)
 

Function Documentation

◆ adjacentCell()

static QTextTableCell adjacentCell ( QTextTable * table,
const QTextTableCell & cell,
QCss::Edge edge )
inlinestatic

Definition at line 1261 of file qtextdocumentlayout.cpp.

References QCss::BottomEdge, QTextTableCell::column(), QTextTableCell::columnSpan(), QCss::LeftEdge, QCss::RightEdge, QTextTableCell::row(), QTextTableCell::rowSpan(), and QCss::TopEdge.

Referenced by axisEdgeData(), QTextDocumentLayoutPrivate::drawTableCellBorder(), and prioritizedEdgeAnchorOffset().

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

◆ adjacentEdge()

static QCss::Edge adjacentEdge ( QCss::Edge edge)
inlinestatic

Definition at line 1235 of file qtextdocumentlayout.cpp.

References QCss::BottomEdge, QCss::LeftEdge, QCss::NumEdges, QCss::RightEdge, and QCss::TopEdge.

Referenced by axisEdgeData(), and isSameAxis().

+ Here is the caller graph for this function:

◆ adjustContextSelectionsForCell()

static void adjustContextSelectionsForCell ( QAbstractTextDocumentLayout::PaintContext & cell_context,
const QTextTableCell & cell,
int r,
int c,
const int * selectedTableCells )
static

Definition at line 977 of file qtextdocumentlayout.cpp.

References QTextTableCell::firstPosition(), QTextFormat::FullWidthSelection, i, QTextCursor::KeepAnchor, and QTextTableCell::lastPosition().

Referenced by QTextDocumentLayoutPrivate::drawFrame().

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

◆ axisEdgeData()

static EdgeData axisEdgeData ( QTextTable * table,
const QTextTableData * td,
const QTextTableCell & cell,
QCss::Edge edge )
inlinestatic

Definition at line 1371 of file qtextdocumentlayout.cpp.

References adjacentCell(), adjacentEdge(), QTextTableData::borderCollapse, QCss::BottomEdge, cellEdgeData(), QTextTableCell::isValid(), QCss::LeftEdge, Q_ASSERT, qMax(), QCss::RightEdge, sharesAxis(), and QCss::TopEdge.

Referenced by QTextTableData::cellBorderWidth(), cellClipTest(), checkJoinedEdge(), drawCellBorder(), and QTextDocumentLayoutPrivate::layoutCell().

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

◆ borderPropertyForEdge()

static QTextFormat::Property borderPropertyForEdge ( QCss::Edge edge)
inlinestatic

Definition at line 1203 of file qtextdocumentlayout.cpp.

References QCss::BottomEdge, QCss::LeftEdge, QCss::RightEdge, QTextFormat::TableCellBottomBorder, QTextFormat::TableCellLeftBorder, QTextFormat::TableCellRightBorder, QTextFormat::TableCellTopBorder, QCss::TopEdge, and QTextFormat::UserProperty.

Referenced by cellEdgeData().

+ Here is the caller graph for this function:

◆ borderStylePropertyForEdge()

static QTextFormat::Property borderStylePropertyForEdge ( QCss::Edge edge)
inlinestatic

Definition at line 1219 of file qtextdocumentlayout.cpp.

References QCss::BottomEdge, QCss::LeftEdge, QCss::RightEdge, QTextFormat::TableCellBottomBorderStyle, QTextFormat::TableCellLeftBorderStyle, QTextFormat::TableCellRightBorderStyle, QTextFormat::TableCellTopBorderStyle, QCss::TopEdge, and QTextFormat::UserProperty.

Referenced by cellEdgeData().

+ Here is the caller graph for this function:

◆ cellClipTest()

static bool cellClipTest ( QTextTable * table,
QTextTableData * td,
const QAbstractTextDocumentLayout::PaintContext & cell_context,
const QTextTableCell & cell,
QRectF cellRect )
static

Definition at line 1011 of file qtextdocumentlayout.cpp.

References QRectF::adjust(), axisEdgeData(), QTextFrameData::border, QTextTableData::borderCollapse, QCss::BottomEdge, QRectF::intersects(), QCss::LeftEdge, Q_UNUSED, QCss::RightEdge, QCss::TopEdge, and QFixed::toReal().

Referenced by QTextDocumentLayoutPrivate::drawFrame().

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

◆ cellEdgeData()

static EdgeData cellEdgeData ( QTextTable * table,
const QTextTableData * td,
const QTextTableCell & cell,
QCss::Edge edge )
inlinestatic

Definition at line 1333 of file qtextdocumentlayout.cpp.

References borderPropertyForEdge(), borderStylePropertyForEdge(), QCss::BottomEdge, EdgeData::ClassExplicit, EdgeData::ClassGrid, EdgeData::ClassNone, EdgeData::ClassTableBorder, QTextTableCell::column(), QTextTableCell::columnSpan(), QTextTableData::drawGrid, QTextTableCell::format(), QTextTableCell::isValid(), QCss::LeftEdge, QTextFormat::property(), QCss::RightEdge, QTextTableCell::row(), QTextTableCell::rowSpan(), QVariant::toDouble(), QCss::TopEdge, and QTextFormat::toTableCellFormat().

Referenced by axisEdgeData(), and findWidestOutermostBorder().

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

◆ checkJoinedEdge()

static void checkJoinedEdge ( QTextTable * table,
const QTextTableData * td,
const QTextTableCell & cell,
QCss::Edge competingEdge,
const EdgeData & edgeData,
bool couldHaveContinuation,
EdgeData * maxCompetingEdgeData,
EdgeData * maxOrthogonalEdgeData )
inlinestatic

Definition at line 1423 of file qtextdocumentlayout.cpp.

References axisEdgeData(), EdgeData::edge, isSameAxis(), isVerticalAxis(), and EdgeData::width.

Referenced by prioritizedEdgeAnchorOffset().

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

◆ collapseOffset()

static qreal collapseOffset ( const QTextDocumentLayoutPrivate * p,
const EdgeData & w )
inlinestatic

Definition at line 1446 of file qtextdocumentlayout.cpp.

Referenced by drawCellBorder(), and prioritizedEdgeAnchorOffset().

+ Here is the caller graph for this function:

◆ createData()

static QTextFrameData * createData ( QTextFrame * f)
static

Definition at line 293 of file qtextdocumentlayout.cpp.

Referenced by data().

+ Here is the caller graph for this function:

◆ data()

static QTextFrameData * data ( QTextFrame * f)
inlinestatic

Definition at line 304 of file qtextdocumentlayout.cpp.

References createData().

+ Here is the call graph for this function:

◆ drawCellBorder()

static void drawCellBorder ( const QTextDocumentLayoutPrivate * p,
QPainter * painter,
QTextTable * table,
const QTextTableData * td,
const QTextTableCell & cell,
const QRectF & borderRect,
QCss::Edge edge,
int forceHeaderRow,
bool adjustTopAnchor,
bool adjustBottomAnchor,
bool ignoreEdgesAbove )
inlinestatic

Definition at line 1562 of file qtextdocumentlayout.cpp.

References axisEdgeData(), Qt::black, QTextTableData::borderCollapse, QTextFrameFormat::BorderStyle_None, QCss::BottomEdge, EdgeData::cell, EdgeData::ClassExplicit, collapseOffset(), QTextTableCell::column(), QTextTableData::drawGrid, EdgeData::edge, EdgeData::edgeClass, fmt, QTextTableCell::format(), QCss::LeftEdge, Qt::NoBrush, p1, p2, painter, prioritizedEdgeAnchorOffset(), qCeil(), qDrawEdge(), qFloor(), QCss::RightEdge, QCss::TopEdge, QTextFormat::toTableCellFormat(), and EdgeData::width.

Referenced by QTextDocumentLayoutPrivate::drawTableCellBorder().

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

◆ fillBackground()

static void fillBackground ( QPainter * p,
const QRectF & rect,
QBrush brush,
const QPointF & origin,
const QRectF & gradientRect = QRectF() )
static

Definition at line 458 of file qtextdocumentlayout.cpp.

References Qt::ConicalGradientPattern, Qt::LinearGradientPattern, QGradient::LogicalMode, rect, QTransform::scale(), and QTransform::translate().

Referenced by QTextDocumentLayoutPrivate::drawBlock(), QTextDocumentLayoutPrivate::drawFrameDecoration(), QTextDocumentLayoutPrivate::drawTableCell(), QPlainTextEdit::paintEvent(), and QGraphicsWidget::paintWindowFrame().

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

◆ findWidestOutermostBorder()

static void findWidestOutermostBorder ( QTextTable * table,
QTextTableData * td,
const QTextTableCell & cell,
QCss::Edge edge,
qreal * outerBorders )
inlinestatic

Definition at line 2355 of file qtextdocumentlayout.cpp.

References cellEdgeData().

Referenced by QTextDocumentLayoutPrivate::layoutTable().

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

◆ firstChildPos()

static QFixed firstChildPos ( const QTextFrame * f)
static

Definition at line 2258 of file qtextdocumentlayout.cpp.

References flowPosition().

Referenced by QTextDocumentLayoutPrivate::layoutFlow().

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

◆ flowPosition()

static QFixed flowPosition ( const QTextFrame::iterator & it)
static

Definition at line 2241 of file qtextdocumentlayout.cpp.

References QFixed::fromReal(), it, layout, and QTextBlock::layout().

Referenced by firstChildPos(), and QTextDocumentLayoutPrivate::layoutTable().

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

◆ getLineHeightParams()

static void getLineHeightParams ( const QTextBlockFormat & blockFormat,
const QTextLine & line,
qreal scaling,
QFixed * lineAdjustment,
QFixed * lineBreakHeight,
QFixed * lineHeight,
QFixed * lineBottom )
inlinestatic

Definition at line 3395 of file qtextdocumentlayout.cpp.

References QTextBlockFormat::FixedHeight, QFixed::fromReal(), line, QTextBlockFormat::lineHeight(), QTextBlockFormat::lineHeightType(), QTextBlockFormat::MinimumHeight, qCeil(), and qMax().

Referenced by QTextDocumentLayoutPrivate::layoutBlock().

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

◆ isEmptyBlockAfterTable()

static bool isEmptyBlockAfterTable ( const QTextBlock & block,
const QTextFrame * previousFrame )
inlinestatic

Definition at line 363 of file qtextdocumentlayout.cpp.

References QTextBlock::isValid(), QTextBlock::length(), and QTextBlock::position().

Referenced by QTextDocumentLayoutPrivate::drawFlow(), and QTextDocumentLayoutPrivate::layoutFlow().

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

◆ isEmptyBlockBeforeTable() [1/2]

static bool isEmptyBlockBeforeTable ( const QTextBlock & block,
const QTextBlockFormat & format,
const QTextFrame::Iterator & nextIt )
inlinestatic

Definition at line 342 of file qtextdocumentlayout.cpp.

References QTextFormat::BackgroundBrush, QTextFormat::BlockTrailingHorizontalRulerWidth, QTextBlock::isValid(), QTextBlock::length(), and QTextBlock::position().

Referenced by QTextDocumentLayoutPrivate::drawBlock(), QTextDocumentLayoutPrivate::drawFlow(), QTextDocumentLayoutPrivate::hitTest(), isEmptyBlockBeforeTable(), and QTextDocumentLayoutPrivate::layoutFlow().

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

◆ isEmptyBlockBeforeTable() [2/2]

static bool isEmptyBlockBeforeTable ( const QTextFrame::Iterator & it)
inlinestatic

Definition at line 354 of file qtextdocumentlayout.cpp.

References QTextBlock::blockFormat(), isEmptyBlockBeforeTable(), it, and next.

+ Here is the call graph for this function:

◆ isFrameFromInlineObject()

static bool isFrameFromInlineObject ( QTextFrame * f)
static

Definition at line 312 of file qtextdocumentlayout.cpp.

Referenced by QTextDocumentLayoutPrivate::drawFlow(), QTextDocumentLayoutPrivate::hitTest(), and QTextDocumentLayoutPrivate::layoutFrame().

+ Here is the caller graph for this function:

◆ isLineSeparatorBlockAfterTable()

static bool isLineSeparatorBlockAfterTable ( const QTextBlock & block,
const QTextFrame * previousFrame )
inlinestatic

Definition at line 372 of file qtextdocumentlayout.cpp.

References QString::at(), QTextBlock::isValid(), QTextBlock::length(), QTextBlock::position(), and QTextBlock::text().

Referenced by QTextDocumentLayoutPrivate::layoutFlow().

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

◆ isSameAxis()

static bool isSameAxis ( QCss::Edge e1,
QCss::Edge e2 )
inlinestatic

Definition at line 1251 of file qtextdocumentlayout.cpp.

References adjacentEdge().

Referenced by checkJoinedEdge().

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

◆ isVerticalAxis()

static bool isVerticalAxis ( QCss::Edge e)
inlinestatic

Definition at line 1256 of file qtextdocumentlayout.cpp.

Referenced by checkJoinedEdge(), prioritizedEdgeAnchorOffset(), and sharesAxis().

+ Here is the caller graph for this function:

◆ markFrames()

static void markFrames ( QTextFrame * current,
int from,
int oldLength,
int length )
static

Definition at line 3739 of file qtextdocumentlayout.cpp.

References QTextFrame::childFrames(), QTextFrame::firstPosition(), i, QTextFrame::lastPosition(), markFrames(), and qMax().

Referenced by markFrames().

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

◆ operator<() [1/2]

static bool operator< ( const QCheckPoint & checkPoint,
int pos )
static

Definition at line 453 of file qtextdocumentlayout.cpp.

References pos.

◆ operator<() [2/2]

static bool operator< ( const QCheckPoint & checkPoint,
QFixed y )
static

Definition at line 448 of file qtextdocumentlayout.cpp.

◆ prioritizedEdgeAnchorOffset()

static double prioritizedEdgeAnchorOffset ( const QTextDocumentLayoutPrivate * p,
QTextTable * table,
const QTextTableData * td,
const QTextTableCell & cell,
const EdgeData & edgeData,
QCss::Edge orthogonalEdge,
bool couldHaveContinuation,
bool ignoreEdgesAbove )
inlinestatic

Definition at line 1488 of file qtextdocumentlayout.cpp.

References adjacentCell(), QTextTableData::borderCollapse, checkJoinedEdge(), collapseOffset(), EdgeData::edge, isVerticalAxis(), sharesAxis(), and QCss::TopEdge.

Referenced by drawCellBorder().

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

◆ Q_DECLARE_TYPEINFO()

Q_DECLARE_TYPEINFO ( QCheckPoint ,
Q_PRIMITIVE_TYPE  )

◆ sharesAxis()

static bool sharesAxis ( const QTextTableCell & cell,
QCss::Edge edge,
const QTextTableCell & competingCell,
QCss::Edge competingCellEdge )
inlinestatic

Definition at line 1307 of file qtextdocumentlayout.cpp.

References QCss::BottomEdge, QTextTableCell::column(), QTextTableCell::columnSpan(), isVerticalAxis(), QCss::LeftEdge, Q_ASSERT, QCss::RightEdge, QTextTableCell::row(), QTextTableCell::rowSpan(), and QCss::TopEdge.

Referenced by axisEdgeData(), and prioritizedEdgeAnchorOffset().

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