Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qtextdocumentlayout.cpp File Reference
#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 <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 1260 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 1234 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 976 of file qtextdocumentlayout.cpp.

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

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 1370 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 1202 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 1218 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 1010 of file qtextdocumentlayout.cpp.

References QRectF::adjust(), axisEdgeData(), QTextFrameData::border, QTextTableData::borderCollapse, QCss::BottomEdge, QAbstractTextDocumentLayout::PaintContext::clip, QRectF::intersects(), QRectF::isValid(), 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 1332 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 1422 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 1445 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 292 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 303 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 1561 of file qtextdocumentlayout.cpp.

References axisEdgeData(), Qt::black, QTextTableData::borderCollapse, QTextFrameFormat::BorderStyle_None, QCss::BottomEdge, QRectF::bottomLeft(), QRectF::bottomRight(), 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, QRectF::topLeft(), QRectF::topRight(), 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 457 of file qtextdocumentlayout.cpp.

References Qt::ConicalGradientPattern, Qt::LinearGradientPattern, QGradient::LogicalMode, and rect.

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

+ 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 2346 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 2249 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 2232 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 3386 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 362 of file qtextdocumentlayout.cpp.

References QTextBlock::isValid(), QTextFrame::lastPosition(), 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 341 of file qtextdocumentlayout.cpp.

References QTextFrame::iterator::atEnd(), QTextFormat::BackgroundBrush, QTextFormat::BlockTrailingHorizontalRulerWidth, QTextFrame::iterator::currentFrame(), QTextFrame::firstPosition(), 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 353 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 311 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 371 of file qtextdocumentlayout.cpp.

References QString::at(), QTextBlock::isValid(), QTextFrame::lastPosition(), QTextBlock::length(), QChar::LineSeparator, 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 1250 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 1255 of file qtextdocumentlayout.cpp.

References e.

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 3730 of file qtextdocumentlayout.cpp.

References QList< T >::at(), QTextFrame::childFrames(), QTextFrame::firstPosition(), i, QTextFrame::lastPosition(), markFrames(), qMax(), and QList< T >::size().

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 452 of file qtextdocumentlayout.cpp.

References pos, and QCheckPoint::positionInFrame.

◆ operator<() [2/2]

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

Definition at line 447 of file qtextdocumentlayout.cpp.

References QCheckPoint::y.

◆ 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 1487 of file qtextdocumentlayout.cpp.

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

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 1306 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: