48 #include "private/qcssutil_p.h" 62 #include "private/qfunctions_p.h" 67 #define LDEBUG qDebug() 68 #define INC_INDENT debug_indent += " " 69 #define DEC_INDENT debug_indent = debug_indent.left(debug_indent.length()-2) 71 #define LDEBUG if(0) qDebug() 72 #define INC_INDENT do {} while(0) 73 #define DEC_INDENT do {} while(0) 145 if (updateRectForFloats.
isValid())
146 updateRectForFloats |= rect;
148 updateRectForFloats = rect;
152 {
return frameY + y; }
155 {
return pageHeight == 0 ? 0 : (absoluteY() / pageHeight).truncate(); }
158 {
if (pageHeight ==
QFIXED_MAX)
return; pageBottom += pageHeight; y = pageBottom - pageHeight + pageBottomMargin + pageTopMargin - frameY; }
182 {
return columnPositions.
at(column + colspan - 1) + widths.
at(column + colspan - 1)
183 - columnPositions.
at(column); }
188 rowPositions[row] = rowPositions.
at(row - 1) + heights.
at(row - 1) +
border + cellSpacing +
border;
227 return cellPosition(cell.
row(), cell.
column()) +
QFixedPoint(leftPadding(fmt), topPadding(fmt));
230 void updateTableSize();
234 {
return QFixedPoint(columnPositions.
at(col), rowPositions.
at(row) + cellVerticalOffsets.
at(col + row * widths.
size())); }
240 if (qobject_cast<QTextTable *>(f))
275 const int row = cell.
row();
276 const int rowSpan = cell.
rowSpan();
277 const int column = cell.
column();
280 return QRectF(columnPositions.at(column).toReal(),
281 rowPositions.at(row).toReal(),
282 (columnPositions.at(column + colSpan - 1) + widths.at(column + colSpan - 1) - columnPositions.at(column)).
toReal(),
283 (rowPositions.at(row + rowSpan - 1) + heights.at(row + rowSpan - 1) - rowPositions.at(row)).
toReal());
288 return !nextIt.
atEnd()
394 return checkPoint.
y < y;
406 if (!gradientRect.isNull()) {
408 m.
translate(gradientRect.left(), gradientRect.top());
409 m.
scale(gradientRect.width(), gradientRect.height());
480 bool withPageBreaks);
504 void ensureLayouted(
QFixed y)
const;
505 void ensureLayoutedByPosition(
int position)
const;
507 { ensureLayoutedByPosition(
INT_MAX); }
508 void layoutStep()
const;
517 : fixedColumnWidth(-1),
519 currentLazyLayoutPosition(-1),
520 lazyLayoutStepSize(1000),
535 return rootFrame->
begin();
539 return rootFrame->
begin();
556 const int block = map.
findNode(position);
557 const int blockPos = map.
position(block);
562 if (containingFrame != rootFrame) {
563 while (containingFrame->
parentFrame() != rootFrame) {
568 it.
cf = containingFrame;
590 if (frame != rootFrame) {
591 if (relativePoint.
y < 0 || relativePoint.
x < 0) {
607 if (
QTextTable *table = qobject_cast<QTextTable *>(frame)) {
608 const int rows = table->rows();
609 const int columns = table->columns();
613 for (
int r = 0; r < rows; ++r) {
614 for (
int c = 0;
c < columns; ++
c) {
621 const QFixedPoint pointInCell = relativePoint - cellPos;
624 for (
int i = 0; i < childFrames.
size(); ++i) {
637 return hitTest(table, relativePoint, position, l, accuracy);
641 for (
int i = 0; i < childFrames.
size(); ++i) {
653 if (frame == rootFrame) {
678 hp =
hitTest(c, p, &pos, l, accuracy);
692 }
else if (hp ==
PointAfter && pos > *position) {
765 for (
int i = 0; i < tl->
lineCount(); ++i) {
768 if (lr.
top() > pos.
y()) {
770 }
else if (lr.
bottom() <= pos.
y()) {
814 const int topPage = pageHeight > 0 ?
static_cast<int>(rect.
top() / pageHeight) : 0;
815 const int bottomPage = pageHeight > 0 ?
static_cast<int>((rect.
bottom() + border) / pageHeight) : 0;
817 #ifndef QT_NO_CSSPARSER 819 #endif //QT_NO_CSSPARSER 824 for (
int i = topPage; i <= bottomPage; ++i) {
827 if (topPage != bottomPage) {
828 clipped.
setTop(
qMax(clipped.
top(), i * pageHeight + topMargin - border));
834 #ifndef QT_NO_CSSPARSER 848 #endif //QT_NO_CSSPARSER 850 if (turn_off_antialiasing)
885 const qreal w = rect.
width() - 2 * border - leftMargin - rightMargin;
886 const qreal h = rect.
height() - 2 * border - topMargin - bottomMargin;
899 const int *selectedTableCells)
901 for (
int i = 0; i < cell_context.
selections.size(); ++i) {
902 int row_start = selectedTableCells[i * 4];
903 int col_start = selectedTableCells[i * 4 + 1];
904 int num_rows = selectedTableCells[i * 4 + 2];
905 int num_cols = selectedTableCells[i * 4 + 3];
907 if (row_start != -1) {
908 if (r >= row_start && r < row_start + num_rows
909 && c >= col_start && c < col_start + num_cols)
915 if (firstPosition == lastPosition)
918 cell_context.
selections[i].cursor.setPosition(firstPosition);
921 cell_context.
selections[i].cursor.clearSelection();
953 QPointF offsetOfRepaintedCursorBlock = off;
959 const int rows = table->
rows();
960 const int columns = table->
columns();
964 for (
int i = 0; i < context.
selections.size(); ++i) {
966 int row_start = -1, col_start = -1, num_rows = -1, num_cols = -1;
971 selectedTableCells[i * 4] = row_start;
972 selectedTableCells[i * 4 + 1] = col_start;
973 selectedTableCells[i * 4 + 2] = num_rows;
974 selectedTableCells[i * 4 + 3] = num_cols;
981 const int tableStartPage = (td->
position.
y / pageHeight).truncate();
989 int page = tableStartPage + 1;
990 while (page <= tableEndPage) {
993 for (
int r = 0; r < headerRowCount; ++r) {
994 for (
int c = 0;
c < columns; ++
c) {
1002 int leftAdjust =
qMin(
qreal(0), 1 - border);
1003 if (cell_context.
clip.
isValid() && !cellRect.adjusted(leftAdjust, leftAdjust, border, border).intersects(cell_context.
clip))
1006 drawTableCell(cellRect, painter, cell_context, table, td, r,
c, &cursorBlockNeedingRepaint,
1007 &offsetOfRepaintedCursorBlock);
1030 for (
int c = 0;
c < columns; ++
c) {
1032 firstRow =
qMin(firstRow, cell.
row());
1035 for (
int r = firstRow; r < lastRow; ++r) {
1036 for (
int c = 0;
c < columns; ++
c) {
1044 int leftAdjust =
qMin(
qreal(0), 1 - border);
1045 if (cell_context.
clip.
isValid() && !cellRect.adjusted(leftAdjust, leftAdjust, border, border).intersects(cell_context.
clip))
1048 drawTableCell(cellRect, painter, cell_context, table, td, r,
c, &cursorBlockNeedingRepaint,
1049 &offsetOfRepaintedCursorBlock);
1065 drawFlow(off, painter, context, it, floats, &cursorBlockNeedingRepaint);
1068 if (cursorBlockNeedingRepaint.
isValid()) {
1069 const QPen oldPen = painter->
pen();
1072 cursorBlockNeedingRepaint.
layout()->
drawCursor(painter, offsetOfRepaintedCursorBlock,
1090 int cr = cell.
row();
1106 const QPen oldPen = painter->
pen();
1110 QRectF borderRect(cellRect.
left() - border, cellRect.
top() - border, cellRect.
width() + border, cellRect.
height() + border);
1114 switch (cellBorder) {
1135 if (r >= headerRowCount)
1138 drawBorder(painter, borderRect, topMargin, bottomMargin,
1157 cellRect.
top() + (topPadding + verticalOffset).
toReal());
1163 if (repaintBlock.isValid()) {
1164 *cursorBlockNeedingRepaint = repaintBlock;
1165 *cursorBlockOffset = cellPos;
1190 int currentPosInDoc;
1203 && currentPosInDoc >= lastVisibleCheckPoint->positionInFrame
1226 *cursorBlockNeedingRepaint = previousBlock;
1233 for (
int i = 0; i < floats.
count(); ++i) {
1281 for (
int i = 0; i < context.
selections.size(); ++i) {
1285 if (selStart < bllen && selEnd > 0
1286 && selEnd > selStart) {
1289 o.
length = selEnd - selStart;
1291 selections.append(o);
1303 selections.append(o);
1305 if (selStart < 0 && selEnd >= 1)
1306 selFormat = &range.
format;
1336 painter->
drawLine(
QLineF(middleX - width / 2, y, middleX + width / 2, y));
1351 if (q->paintDevice())
1352 font =
QFont(font, q->paintDevice());
1357 int style = lf.
style();
1384 itemText =
static_cast<QTextList *
>(object)->itemText(bl);
1405 xoff = -xoff - size.
width();
1412 int horizontalOffset = -r.
left();
1425 if (selectionFormat) {
1501 QFixed absoluteTableY,
bool withPageBreaks)
1505 layoutStruct.
frame = t;
1512 if (withPageBreaks) {
1526 if (layoutStruct.
pageHeight < 0 || !withPageBreaks)
1528 const int currentPage = layoutStruct.
currentPage();
1536 layoutStruct.
y =
qMax(layoutStruct.
y, pageTop);
1539 for (
int i = 0; i < childFrames.
size(); ++i) {
1553 for (
int i = 0; i < childFrames.
size(); ++i) {
1573 return layoutStruct;
1581 const int rows = table->
rows();
1582 const int columns = table->
columns();
1589 for (
int i = 0; i < children.
count(); ++i) {
1597 if (columnWidthConstraints.
size() != columns)
1598 columnWidthConstraints.
resize(columns);
1612 recalc_minmax_widths:
1616 remainingWidth -= columns * 2 * td->
border;
1618 remainingWidth -= (columns - 1) * cellSpacing;
1620 remainingWidth -= 2 * cellSpacing;
1622 const QFixed initialTotalWidth = remainingWidth;
1637 for (
int i = 0; i < columns; ++i) {
1638 for (
int row = 0; row < rows; ++row) {
1642 if (cspan > 1 && i != cell.
column())
1648 const QFixed widthPadding = leftPadding + rightPadding;
1654 layoutTo, td, absoluteTableY,
1659 for (
int n = 0; n < cspan; ++n) {
1660 const int col = i + n;
1661 QFixed w = widthToDistribute / (cspan - n);
1664 if (widthToDistribute <= 0)
1678 widthToDistribute = maxW;
1679 for (
int n = 0; n < cspan; ++n) {
1680 const int col = i + n;
1681 QFixed w = widthToDistribute / (cspan - n);
1684 if (widthToDistribute <= 0)
1693 int variableCols = 0;
1694 QFixed totalMinWidth = 0;
1695 for (
int i = 0; i < columns; ++i) {
1699 remainingWidth -= td->
widths.
at(i);
1713 const QFixed totalPercentagedWidth = initialTotalWidth * totalPercentage / 100;
1714 QFixed remainingMinWidths = totalMinWidth;
1715 for (
int i = 0; i < columns; ++i) {
1720 const QFixed percentWidth = totalPercentagedWidth * allottedPercentage / totalPercentage;
1726 remainingWidth -= td->
widths.
at(i);
1732 if (variableCols > 0 && remainingWidth > 0) {
1734 for (
int i = 0; i < columns; ++i)
1737 columnsWithProperMaxSize.
append(i);
1739 QFixed lastRemainingWidth = remainingWidth;
1740 while (remainingWidth > 0) {
1741 for (
int k = 0; k < columnsWithProperMaxSize.
count(); ++k) {
1742 const int col = columnsWithProperMaxSize[k];
1743 const int colsLeft = columnsWithProperMaxSize.
count() - k;
1746 remainingWidth -= w;
1748 if (remainingWidth == lastRemainingWidth)
1750 lastRemainingWidth = remainingWidth;
1753 if (remainingWidth > 0
1756 const QFixed widthPerAnySizedCol = remainingWidth / variableCols;
1757 for (
int col = 0; col < columns; ++col) {
1759 td->
widths[col] += widthPerAnySizedCol;
1767 for (
int i = 1; i < columns; ++i)
1779 goto recalc_minmax_widths;
1792 bool haveRowSpannedCells =
false;
1796 cellHeights.
reserve(rows * columns);
1799 if (pageHeight <= 0)
1803 heightToDistribute.
resize(columns);
1808 bool hasDroppedTable =
false;
1814 for (
int r = 0; r < rows; ++r) {
1817 const int tableStartPage = (absoluteTableY / pageHeight).truncate();
1818 const int currentPage = ((td->
rowPositions[r] + absoluteTableY) / pageHeight).truncate();
1821 const QFixed nextPageTop = pageTop + pageHeight;
1828 bool dropRowToNextPage =
true;
1829 int cellCountBeforeRow = cellHeights.
size();
1839 if (r <= headerRowCount && rowStartPage > tableStartPage && !hasDroppedTable) {
1841 cellHeights.
clear();
1843 hasDroppedTable =
true;
1848 int rowCellCount = 0;
1849 for (
int c = 0;
c < columns; ++
c) {
1851 const int rspan = cell.
rowSpan();
1854 if (cspan > 1 && cell.
column() !=
c)
1858 haveRowSpannedCells =
true;
1860 const int cellRow = cell.
row();
1863 if (cellRow + rspan - 1 == r)
1875 const QFixed widthPadding = leftPadding + rightPadding;
1881 layoutFrom, layoutTo,
1885 const QFixed height = layoutStruct.
y + bottomPadding + topPadding;
1888 heightToDistribute[
c] = height + dropDistance;
1892 cellHeights.
append(layoutStruct.
y);
1895 if (childPos < pageBottom)
1896 dropRowToNextPage =
false;
1899 if (rowCellCount > 0 && dropRowToNextPage) {
1903 dropRowToNextPage =
false;
1904 cellHeights.
resize(cellCountBeforeRow);
1905 if (r > headerRowCount)
1910 if (haveRowSpannedCells) {
1912 for (
int c = 0;
c < columns; ++
c)
1913 heightToDistribute[
c] =
qMax(heightToDistribute.
at(
c) - effectiveHeight - dropDistance,
QFixed(0));
1916 if (r == headerRowCount - 1) {
1929 for (
int r = 0; r < rows; ++r) {
1930 for (
int c = 0;
c < columns; ++
c) {
1935 const int rowSpan = cell.
rowSpan();
1944 offset = (availableHeight - cellHeight) / 2;
1947 offset = availableHeight - cellHeight;
1953 for (
int rd = 0; rd < cell.
rowSpan(); ++rd) {
1954 for (
int cd = 0; cd < cell.
columnSpan(); ++cd) {
1955 const int index = (
c + cd) + (r + rd) * columns;
1963 for (
int i = 0; i < columns; ++i) {
1969 for (
int i = 0; i < columns; ++i)
2011 y = layoutStruct->
y;
2013 frameSpansIntoNextPage =
false;
2037 if (qobject_cast<QTextTable *>(frame) != 0)
2043 LDEBUG <<
"layoutFrame (pre)";
2062 return layoutFrame(f, layoutFrom, layoutTo, width, height, parentY);
2067 LDEBUG <<
"layoutFrame from=" << layoutFrom <<
"to=" << layoutTo;
2092 if (qobject_cast<QTextTable *>(parent)) {
2102 newContentsWidth = frameWidth - 2*(fd->
border + fd->
padding)
2105 if (frameHeight != -1) {
2118 if (
QTextTable *table = qobject_cast<QTextTable *>(f)) {
2120 return layoutTable(table, layoutFrom, layoutTo, parentY);
2129 layoutStruct.
frame = f;
2131 layoutStruct.
x_right = layoutStruct.
x_left + newContentsWidth;
2139 LDEBUG <<
"layoutStruct: x_left" << layoutStruct.
x_left <<
"x_right" << layoutStruct.
x_right 2156 layoutFlow(it, &layoutStruct, layoutFrom, layoutTo);
2158 QFixed maxChildFrameWidth = 0;
2160 for (
int i = 0; i < children.
size(); ++i) {
2163 maxChildFrameWidth =
qMax(maxChildFrameWidth, cd->
size.
width);
2174 if (newContentsWidth <= 0) {
2184 fd->
size.
width = actualWidth + marginWidth;
2192 int layoutFrom,
int layoutTo,
QFixed width)
2194 LDEBUG <<
"layoutFlow from=" << layoutFrom <<
"to=" << layoutTo;
2205 if (!redoCheckPoints) {
2211 layoutStruct->
y = checkPoint->y;
2212 layoutStruct->
frameY = checkPoint->frameY;
2230 redoCheckPoints =
true;
2234 if (redoCheckPoints) {
2237 cp.
y = layoutStruct->
y;
2249 QFixed maximumBlockWidth = 0;
2250 while (!it.
atEnd()) {
2263 if (left == layoutStruct->
x_left && right == layoutStruct->
x_right) {
2265 p.
y = layoutStruct->
y;
2296 if (right - left < cd->size.width) {
2327 absoluteChildPos += layoutStruct->
frameY;
2330 if (absoluteChildPos > layoutStruct->
pageBottom) {
2332 pos.
y = layoutStruct->
y;
2367 updateRect =
layoutFrame(c, layoutFrom, layoutTo);
2373 updateRect =
layoutFrame(c, layoutFrom, layoutTo);
2377 if (frameRect == oldFrameRect && updateRect.isValid())
2380 updateRect = frameRect;
2383 if (oldFrameRect.isValid())
2394 if (!previousIt.
atEnd())
2395 lastIt = previousIt;
2405 const QFixed origY = layoutStruct->
y;
2412 previousBlockFormatPtr = &previousBlockFormat;
2415 layoutBlock(block, docPos, blockFormat, layoutStruct, layoutFrom, layoutTo, previousBlockFormatPtr);
2439 layoutStruct->
y = origY;
2450 if (layoutStruct->
pageBottom == origPageBottom) {
2451 layoutStruct->
y -= height;
2455 layoutStruct->
y = origY - height;
2457 layoutBlock(block, docPos, blockFormat, layoutStruct, layoutFrom, layoutTo, previousBlockFormatPtr);
2472 previousBlockFormat = blockFormat;
2483 if (!qobject_cast<QTextTable *>(layoutStruct->
frame)) {
2485 for (
int i = 0; i < children.
count(); ++i) {
2502 cp.
y = layoutStruct->
y;
2526 *lineBreakHeight = *lineHeight;
2534 *lineAdjustment = 0;
2544 const int blockLength = bl.
length();
2546 LDEBUG <<
"layoutBlock from=" << layoutFrom <<
"to=" << layoutTo;
2550 if (previousBlockFormat) {
2552 if (margin > 0 && q->paintDevice()) {
2576 || (blockPosition + blockLength > layoutFrom && blockPosition <= layoutTo)
2599 const QFixed cy = layoutStruct->
y;
2604 bool firstLine =
true;
2613 left =
qMax(left, l);
2614 right =
qMin(right, r);
2619 left += text_indent;
2621 right -= text_indent;
2633 left =
qMax(left, l);
2634 right =
qMin(right, r);
2636 left += text_indent;
2638 right -= text_indent;
2646 if (haveWordOrAnyWrapMode) {
2655 left =
qMax(left, l);
2656 right =
qMin(right, r);
2658 left += text_indent;
2660 right -= text_indent;
2663 if (haveWordOrAnyWrapMode) {
2671 QFixed lineBreakHeight, lineHeight, lineAdjustment;
2672 qreal scaling = (q->paintDevice() && q->paintDevice()->logicalDpiY() !=
qt_defaultDpi()) ?
2674 getLineHeightParams(blockFormat, line, scaling, &lineAdjustment, &lineBreakHeight, &lineHeight);
2680 left =
qMax(left, l);
2681 right =
qMin(right, r);
2683 left += text_indent;
2685 right -= text_indent;
2689 layoutStruct->
y += lineHeight;
2703 for (
int i = 0; i < cnt; ++i) {
2704 LDEBUG <<
"going to move text line" << i;
2709 QFixed lineBreakHeight, lineHeight, lineAdjustment;
2710 qreal scaling = (q->paintDevice() && q->paintDevice()->logicalDpiY() !=
qt_defaultDpi()) ?
2712 getLineHeightParams(blockFormat, line, scaling, &lineAdjustment, &lineBreakHeight, &lineHeight);
2719 layoutStruct->
y += lineHeight;
2722 && blockLength > 1) {
2723 if (layoutFrom >= blockPosition + blockLength) {
2728 }
else if (layoutTo < blockPosition) {
2742 const QFixed margins = totalLeftMargin + totalRightMargin;
2759 *left = layoutStruct->
x_left;
2760 *right = layoutStruct->
x_right;
2762 for (
int i = 0; i < lfd->
floats.
size(); ++i) {
2780 requiredWidth =
qMin(requiredWidth, layoutStruct->
x_right - layoutStruct->
x_left);
2786 if (right-left >= requiredWidth)
2792 for (
int i = 0; i < lfd->
floats.
size(); ++i) {
2825 d->ensureLayoutFinished();
2829 if (
d->document->pageSize().width() == 0 &&
d->viewportRect.isValid()) {
2837 d->drawFrame(
QPointF(), painter, context, frame);
2844 d->viewportRect = viewport;
2849 int end =
qMax(oldLength, length) + from;
2855 for (
int i = 0; i < fd->
floats.
size(); ++i) {
2869 for (
int i = 0; i < children.
size(); ++i)
2880 endIt = endIt.
next();
2881 for (; blockIt.
isValid() && blockIt != endIt; blockIt = blockIt.
next())
2884 if (
d->docPrivate->pageSize.isNull())
2889 d->lazyLayoutStepSize = 1000;
2890 d->sizeChangedTimer.stop();
2891 d->insideDocumentChange =
true;
2893 const int documentLength =
d->docPrivate->length();
2894 const bool fullLayout = (oldLength == 0 && length == documentLength);
2895 const bool smallChange = documentLength > 0
2896 && (
qMax(length, oldLength) * 100 / documentLength) < 5;
2903 && (
d->currentLazyLayoutPosition == -1 ||
d->showLayoutProgress ==
false))
2904 d->showLayoutProgress =
false;
2906 d->showLayoutProgress =
true;
2909 d->contentHasAlignment =
false;
2910 d->currentLazyLayoutPosition = 0;
2911 d->checkPoints.clear();
2914 d->ensureLayoutedByPosition(from);
2915 updateRect =
doLayout(from, oldLength, length);
2918 if (!
d->layoutTimer.isActive() &&
d->currentLazyLayoutPosition != -1)
2919 d->layoutTimer.start(10,
this);
2921 d->insideDocumentChange =
false;
2923 if (
d->showLayoutProgress) {
2925 if (newSize !=
d->lastReportedSize) {
2926 d->lastReportedSize = newSize;
2946 markFrames(
d->docPrivate->rootFrame(), from, oldLength, length);
2951 if(
data(root)->sizeDirty)
2952 updateRect =
d->layoutFrame(root, from, from + length);
2955 if (
d->currentLazyLayoutPosition == -1)
2957 else if (
d->showLayoutProgress)
2958 d->sizeChangedTimer.start(0,
this);
2981 if (position > lastPos)
2983 else if (position < 0)
2995 if (!handler.component)
2998 QSizeF intrinsic = handler.iface->intrinsicSize(
d->document, posInDocument, format);
3034 if (item.
width() != 0)
3041 if (!handler.component)
3054 d->positionFloat(frame, line.
isValid() ? &line : 0);
3074 const QSizeF pgSize =
d->document->pageSize();
3083 return data(
d->docPrivate->rootFrame())->size.toSizeF();
3089 d->ensureLayoutFinished();
3096 d->ensureLayoutFinished();
3103 if (currentLazyLayoutPosition == -1)
3105 const QSizeF oldSize = q->dynamicDocumentSize();
3108 if (checkPoints.isEmpty())
3111 while (currentLazyLayoutPosition != -1
3112 && checkPoints.last().y < y)
3118 if (currentLazyLayoutPosition == -1)
3120 if (position < currentLazyLayoutPosition)
3122 while (currentLazyLayoutPosition != -1
3123 && currentLazyLayoutPosition < position) {
3130 ensureLayoutedByPosition(currentLazyLayoutPosition + lazyLayoutStepSize);
3131 lazyLayoutStepSize =
qMin(200000, lazyLayoutStepSize * 2);
3137 d->cursorWidth = width;
3143 return d->cursorWidth;
3149 d->fixedColumnWidth = width;
3155 if (
d->docPrivate->pageSize.isNull())
3157 d->ensureLayoutFinished();
3158 return d->frameBoundingRectInternal(frame);
3170 if (
QTextTable *table = qobject_cast<QTextTable *>(f)) {
3173 pos += static_cast<QTextTableData *>(fd)->cellPosition(cell).toPointF();
3178 return QRectF(pos,
data(frame)->size.toSizeF());
3184 if (
d->docPrivate->pageSize.isNull() || !block.
isValid())
3189 const int blockPos = block.
position();
3195 if (
QTextTable *table = qobject_cast<QTextTable *>(frame)) {
3198 offset += static_cast<QTextTableData *>(fd)->cellPosition(cell).toPointF();
3213 int pos =
d->currentLazyLayoutPosition;
3216 return pos * 100 /
d->document->docHandle()->length();
3222 if (e->
timerId() ==
d->layoutTimer.timerId()) {
3223 if (
d->currentLazyLayoutPosition != -1)
3225 }
else if (e->
timerId() ==
d->sizeChangedTimer.timerId()) {
3228 d->sizeChangedTimer.stop();
3230 if (
d->currentLazyLayoutPosition == -1) {
3232 if (newCount !=
d->lastPageCount) {
3233 d->lastPageCount = newCount;
3245 d->layoutTimer.stop();
3246 if (!
d->insideDocumentChange)
3247 d->sizeChangedTimer.start(0,
this);
3249 d->showLayoutProgress =
true;
3260 d->ensureLayoutFinished();
3261 return d->idealWidth;
3267 return d->contentHasAlignment;
3286 #include "moc_qtextdocumentlayout_p.cpp"
The QVariant class acts like a union for the most common Qt data types.
T qobject_cast(QObject *object)
The QMultiHash class is a convenience QHash subclass that provides multi-valued hashes.
The QPainter class performs low-level painting on widgets and other paint devices.
QPaintDevice * device() const
Returns the paint device on which this painter is currently painting, or 0 if the painter is not acti...
int columns() const
Returns the number of columns in the table.
QSizeF pageSize
the page size that should be used for laying out the document
qreal cellSpacing() const
Returns the table's cell spacing.
QFont font() const
Returns the font for this character format.
QTextOption textOption() const
Returns the current text option used to control the layout process.
The QTextLayout::FormatRange structure is used to apply extra formatting information for a specified ...
qreal y() const
Returns the y-coordinate of the rectangle's top edge.
int width(const QString &, int len=-1) const
Returns the width in pixels of the first len characters of text.
Q_OUTOFLINE_TEMPLATE RandomAccessIterator qUpperBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value)
qreal right() const
Returns the x-coordinate of the rectangle's right edge.
QRectF updateRectForFloats
QString text() const
Returns the block's contents as plain text.
void registerHandler(int objectType, QObject *component)
Registers the given component as a handler for items of the given objectType.
QPointF position() const
The global position of the layout.
QMultiHash< int, QTextFrame * > childFrameMap
The QTextCharFormat class provides formatting information for characters in a QTextDocument.
void setFixedColumnWidth(int width)
The QTextListFormat class provides formatting information for lists in a QTextDocument.
static QFixed firstChildPos(const QTextFrame *f)
QTextCharFormat charFormat() const
Returns the format of the character immediately before the cursor position().
void setHeight(qreal h)
Sets the height of the rectangle to the given height.
void layoutBlock(const QTextBlock &bl, int blockPosition, const QTextBlockFormat &blockFormat, QTextLayoutStruct *layoutStruct, int layoutFrom, int layoutTo, const QTextBlockFormat *previousBlockFormat)
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
The QFontMetrics class provides font metrics information.
#define QT_END_NAMESPACE
This macro expands to.
qreal y() const
Returns the line's y position.
void setPosition(const QPointF &pos)
Moves the line to position pos.
QFixed blockIndent(const QTextBlockFormat &blockFormat) const
void clear()
Removes all items from the hash.
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
qreal maximumWidth() const
The maximum width the layout could expand to; this is essentially the width of the entire text...
const QChar at(int i) const
Returns the character at the given index position in the string.
void calcRowPosition(int row)
void positionFloat(QTextFrame *frame, QTextLine *currentLine=0)
void floatMargins(const QFixed &y, const QTextLayoutStruct *layoutStruct, QFixed *left, QFixed *right) const
QRectF cellRect(const QTextTableCell &cell) const
QTextCharFormat format
the format of the selection
QBasicTimer sizeChangedTimer
QVector< QFixed > heights
int headerRowCount() const
Returns the number of rows in the table that define the header.
const QGradient * gradient() const
Returns the gradient describing this brush.
bool isNull() const
Returns true if this is a NULL variant, false otherwise.
QVector< QCheckPoint > checkPoints
QVector< T > & fill(const T &t, int size=-1)
Assigns value to all items in the vector.
#define it(className, varName)
int count(const T &t) const
Returns the number of occurrences of value in the vector.
void setTabs(QList< Tab > tabStops)
Sets the tab positions for the text layout to those specified by tabStops.
The QTextFrame class represents a frame in a QTextDocument.
static bool isLineSeparatorBlockAfterTable(const QTextBlock &block, const QTextFrame *previousFrame)
void setTransform(const QTransform &)
Sets matrix as an explicit transformation matrix on the current brush.
Type type() const
Returns the type of this length object.
Position
This enum describes how a frame is located relative to the surrounding text.
QTextFrame::iterator begin() const
Returns a frame iterator pointing to the beginning of the table's cell.
qreal width() const
Returns the width.
virtual void drawInlineObject(QPainter *painter, const QRectF &rect, QTextInlineObject object, int posInDocument, const QTextFormat &format)
This function is called to draw the inline object, object, with the given painter within the rectangl...
int selectionEnd() const
Returns the end of the selection or position() if the cursor doesn't have a selection.
QVector< QFixed > rowPositions
QVector< QFixed > columnPositions
PageBreakFlags pageBreakPolicy() const
Returns the currently set page break policy for the paragraph.
static void adjustContextSelectionsForCell(QAbstractTextDocumentLayout::PaintContext &cell_context, const QTextTableCell &cell, int r, int c, const int *selectedTableCells)
QTextFrame * currentFrame() const
Returns the current frame pointed to by the iterator, or 0 if the iterator currently points to a bloc...
int length() const
Returns the number of characters in this string.
void drawTableCell(const QRectF &cellRect, QPainter *painter, const QAbstractTextDocumentLayout::PaintContext &cell_context, QTextTable *table, QTextTableData *td, int r, int c, QTextBlock *cursorBlockNeedingRepaint, QPointF *cursorBlockOffset) const
The QPointF class defines a point in the plane using floating point precision.
qreal height() const
Returns the height.
qreal left() const
Returns the x-coordinate of the rectangle's left edge.
The QTextLine class represents a line of text inside a QTextLayout.
virtual void timerEvent(QTimerEvent *)
This event handler can be reimplemented in a subclass to receive timer events for the object...
static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine)
void restore()
Restores the current painter state (pops a saved state off the stack).
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the vector...
WrapMode
This enum describes how text is wrapped in a document.
int textLength() const
Returns the length of the text in the line.
QRectF layoutTable(QTextTable *t, int layoutFrom, int layoutTo, QFixed parentY)
void drawCursor(QPainter *p, const QPointF &pos, int cursorPosition) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QList< QTextFrame * > pendingFloats
QPointF topLeft() const
Returns the position of the rectangle's top-left corner.
Flags flags() const
Returns the flags associated with the option.
QTextDocument * document() const
Returns the text document that this layout is operating on.
qreal leading() const
Returns the line's leading.
void setTop(qreal pos)
Sets the top edge of the rectangle to the given y coordinate.
QRectF boundingRect() const
The smallest rectangle that contains all the lines in the layout.
void positionInlineObject(QTextInlineObject item, int posInDocument, const QTextFormat &format)
Lays out the inline object item using the given text format.
HitPoint hitTest(QTextFrame *frame, const QFixedPoint &point, int *position, QTextLayout **l, Qt::HitTestAccuracy accuracy) const
QTextFrame::Iterator frameIteratorForYPosition(QFixed y) const
void setBottom(qreal pos)
Sets the bottom edge of the rectangle to the given y coordinate.
QTextCursor cursor
the selection's cursor
int count(const T &t) const
Returns the number of occurrences of value in the list.
QFixed bottomPadding(const QTextFormat &format) const
void setLineWidth(qreal width)
Lays out the line with the given width.
void drawBlock(const QPointF &offset, QPainter *painter, const QAbstractTextDocumentLayout::PaintContext &context, QTextBlock bl, bool inRootFrame) const
void drawLine(const QLineF &line)
Draws a line defined by line.
int start
Specifies the beginning of the format range within the text layout's text.
qreal leftMargin() const
Returns the width of the frame's left margin in pixels.
The QString class provides a Unicode character string.
T * qobject_cast(QObject *object)
static bool qIsNull(double d)
static void getLineHeightParams(const QTextBlockFormat &blockFormat, const QTextLine &line, qreal scaling, QFixed *lineAdjustment, QFixed *lineBreakHeight, QFixed *lineHeight)
bool isValid() const
Returns true if this character format is valid; otherwise returns false.
qreal topMargin() const
Returns the paragraph's top margin.
void setWidth(qreal w)
Sets the width to the given width.
static QFixed fromReal(qreal r)
QPalette palette
the default color that is used for the text, when no color is specified.
Q_DECL_CONSTEXPR T qAbs(const T &t)
void clearLayout()
Clears the QTextLayout that is used to lay out and display the block's contents.
int indent() const
Returns the paragraph's indent.
qreal rightMargin() const
Returns the paragraph's right margin.
void documentSizeChanged(const QSizeF &newSize)
This signal is emitted when the size of the document layout changes to newSize.
int firstPosition() const
Returns the first document position inside the frame.
Qt::Alignment alignment() const
Returns the paragraph's alignment.
static QFixedPoint fromPointF(const QPointF &p)
Q_STATIC_GLOBAL_OPERATOR bool operator<(const QCheckPoint &checkPoint, QFixed y)
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
QTextObject * objectForFormat(const QTextFormat &) const
Returns the text object associated with the format f.
int cursorPosition
the position within the document, where the cursor line should be drawn.
The QPen class defines how a QPainter should draw lines and outlines of shapes.
void setBrushOrigin(int x, int y)
Sets the brush's origin to point (x, y).
bool isValid() const
Returns true if this text line is valid; otherwise returns false.
qreal ascent() const
Returns the line's ascent.
QList< QPointer< QTextFrame > > floats
The QSizeF class defines the size of a two-dimensional object using floating point precision...
void update(const QRectF &=QRectF(0., 0., 1000000000., 1000000000.))
This signal is emitted when the rectangle rect has been updated.
The QChar class provides a 16-bit Unicode character.
void drawBorder(QPainter *painter, const QRectF &rect, qreal topMargin, qreal bottomMargin, qreal border, const QBrush &brush, QTextFrameFormat::BorderStyle style) const
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
void setRight(qreal pos)
Sets the right edge of the rectangle to the given x coordinate.
QTextOption defaultTextOption
void save()
Saves the current painter state (pushes the state onto a stack).
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
QVector< QFixed > cellVerticalOffsets
void drawFlow(const QPointF &offset, QPainter *painter, const QAbstractTextDocumentLayout::PaintContext &context, QTextFrame::Iterator it, const QList< QTextFrame *> &floats, QTextBlock *cursorBlockNeedingRepaint) const
static QTextFrameData * createData(QTextFrame *f)
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
qreal x() const
Returns the x-coordinate of this point.
void resize(int size)
Sets the size of the vector to size.
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the vector...
QTextBlock next() const
Returns the text block in the document after this block, or an empty text block if this is the last o...
QTextLine lineForTextPosition(int pos) const
Returns the line that contains the cursor position specified by pos.
void setDescent(qreal d)
Sets the inline object's decent to d.
int rowSpan() const
Returns the number of rows this cell spans.
QTextFrame * rootFrame() const
Returns the document's root frame.
The QLineF class provides a two-dimensional vector using floating point precision.
int position() const
Returns the index of the block's first character within the document.
QTextDocumentLayoutPrivate()
void qDrawEdge(QPainter *p, qreal x1, qreal y1, qreal x2, qreal y2, qreal dw1, qreal dw2, QCss::Edge edge, QCss::BorderStyle style, QBrush c)
Position position() const
Returns the positioning policy for frames with this frame format.
qreal padding() const
Returns the width of the frame's internal padding in pixels.
The QAbstractTextDocumentLayout::Selection class is a convenience class defining the parameters of a ...
QSizeF documentSize() const
Returns the total size of the document's layout.
void ensureLayouted(QFixed y) const
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the vector.
void selectedTableCells(int *firstRow, int *numRows, int *firstColumn, int *numColumns) const
If the selection spans over table cells, firstRow is populated with the number of the first row in th...
bool hasProperty(int propertyId) const
Returns true if the text format has a property with the given propertyId; otherwise returns false...
virtual QRectF blockBoundingRect(const QTextBlock &block) const
Returns the bounding rectangle of block.
QTextTableCell cellAt(int row, int col) const
Returns the table cell at the given row and column in the table.
void setNumColumns(int columns)
Lays out the line.
Qt::Alignment alignment() const
Returns the table's alignment.
void setAlignment(Qt::Alignment alignment)
Sets the option's text alignment to the specified alignment.
void append(const T &t)
Inserts value at the end of the list.
void setRenderHint(RenderHint hint, bool on=true)
Sets the given render hint on the painter if on is true; otherwise clears the render hint...
int currentLazyLayoutPosition
const QPen & pen() const
Returns the painter's current pen.
#define QT_BEGIN_NAMESPACE
This macro expands to.
qreal scaleToDevice(qreal value) const
QSizeF dynamicDocumentSize() const
void drawEllipse(const QRectF &r)
Draws the ellipse defined by the given rectangle.
Style style() const
Returns the list format's style.
The QRectF class defines a rectangle in the plane using floating point precision. ...
int objectType() const
Returns the text format's object type.
qreal topMargin() const
Returns the width of the frame's top margin in pixels.
QBool contains(const T &t) const
Returns true if the list contains an occurrence of value; otherwise returns false.
QTextCharFormat format() const
Returns the cell's character format.
QTextTableFormat format() const
Returns the table's format.
int column() const
Returns the number of the column in the table that contains this cell.
QPoint brushOrigin() const
Returns the currently set brush origin.
QTextFrame * frameAt(int pos) const
QTextFrameLayoutData * layoutData() const
qreal bottomMargin() const
Returns the width of the frame's bottom margin in pixels.
QPaintDevice * paintDevice
int lastPosition() const
Returns the last document position inside the frame.
bool hasSelection() const
Returns true if the cursor contains a selection; otherwise returns false.
bool contentHasAlignment() const
QTextTable * currentTable() const
Returns a pointer to the current table if the cursor position() is inside a block that is part of a t...
void clear()
Removes all the elements from the vector and releases the memory used by the vector.
Property
This enum describes the different properties a format can have.
Style
This enum describes the symbols used to decorate list items:
The QTextFormat class provides formatting information for a QTextDocument.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QTextFrame * parentFrame() const
Returns the frame's parent frame.
QVector< QFixed > minWidths
The QTextCursor class offers an API to access and modify QTextDocuments.
QTextFrame * rootFrame() const
void setCursorWidth(int width)
qreal height() const
Returns the height of the rectangle.
void layoutFlow(QTextFrame::Iterator it, QTextLayoutStruct *layoutStruct, int layoutFrom, int layoutTo, QFixed width=0)
void drawFrameDecoration(QPainter *painter, QTextFrame *frame, QTextFrameData *fd, const QRectF &clip, const QRectF &rect) const
#define Q_STATIC_GLOBAL_OPERATOR
uint insideDocumentChange
const T & at(int i) const
Returns the item at index position i in the list.
QList< QTextOption::Tab > tabPositions() const
Returns a list of tab positions defined for the text block.
void drawListItem(const QPointF &offset, QPainter *painter, const QAbstractTextDocumentLayout::PaintContext &context, QTextBlock bl, const QTextCharFormat *selectionFormat) const
QFixed rightPadding(const QTextFormat &format) const
bool isEmpty() const
Returns true if the hash contains no items; otherwise returns false.
void append(const T &t)
Inserts value at the end of the vector.
bool contains(int position) const
Returns true if the given position is located within the text block; otherwise returns false...
void moveTopLeft(const QPointF &p)
Moves the rectangle, leaving the top-left corner at the given position.
QRectF doLayout(int from, int oldLength, int length)
int & rx()
Returns a reference to the x coordinate of this point.
QRectF frameBoundingRectInternal(QTextFrame *frame) const
int timerId() const
Returns the unique timer identifier, which is the same identifier as returned from QObject::startTime...
The QTextBlock class provides a container for text fragments in a QTextDocument.
QFixed effectiveBottomMargin
qreal x() const
Returns the line's x position.
int pageCount() const
Returns the number of pages contained in the layout.
uint position(uint node, uint field=0) const
qreal width() const
Returns the width of the rectangle.
QTextListFormat toListFormat() const
Returns this format as a list format.
QFixed paddingProperty(const QTextFormat &format, QTextFormat::Property property) const
int row() const
Returns the number of the row in the table that contains this cell.
void setTextDirection(Qt::LayoutDirection aDirection)
Sets the direction of the text layout defined by the option to the given direction.
QRectF layoutFrame(QTextFrame *f, int layoutFrom, int layoutTo, QFixed parentY=0)
void drawFrame(const QPointF &offset, QPainter *painter, const QAbstractTextDocumentLayout::PaintContext &context, QTextFrame *f) const
void clear()
Removes all items from the list.
QRectF clip
a hint to the layout specifying the area around paragraphs, frames or text require painting...
void draw(QPainter *p, const QPointF &pos, const QVector< FormatRange > &selections=QVector< FormatRange >(), const QRectF &clip=QRectF()) const
Draws the whole layout on the painter p at the position specified by pos.
static void fillBackground(QPainter *p, const QRectF &rect, QBrush brush, const QPointF &origin, QRectF gradientRect=QRectF())
int position() const
Returns the absolute position of the cursor within the document.
int length() const
Returns the length of the block in characters.
QBrush background() const
Returns the brush used to paint the document's background.
Qt::BrushStyle style() const
Returns the brush style.
The QTextTable class represents a table in a QTextDocument.
const BlockMap & blockMap() const
QTextLayoutStruct * currentLayoutStruct
void translate(qreal dx, qreal dy)
Moves the rectangle dx along the x-axis and dy along the y-axis, relative to the current position...
QTextLine lineAt(int i) const
Returns the {i}-th line of text in this text layout.
qreal textIndent() const
Returns the paragraph's text indent.
QRect toRect() const
Returns a QRect based on the values of this rectangle.
void documentChanged(int from, int oldLength, int length)
This function is called whenever the contents of the document change.
The QTextObjectInterface class allows drawing of custom text objects in QTextDocument.
QTextCharFormat charFormat() const
Returns the QTextCharFormat that describes the block's character format.
int preeditAreaPosition() const
Returns the position of the area in the text layout that will be processed before editing occurs...
const QBrush & brush(ColorGroup cg, ColorRole cr) const
Returns the brush in the specified color group, used for the given color role.
const T & at(int i) const
Returns the item at index position i in the vector.
static bool isFrameFromInlineObject(QTextFrame *f)
void setLeadingIncluded(bool included)
Includes positive leading into the line's height if included is true; otherwise does not include lead...
The iterator class provides an iterator for reading the contents of a QTextFrame. ...
QTextLength height() const
Returns the height of the frame's border rectangle.
const QBrush & brush() const
Returns the painter's current brush.
QTextFormat format() const
Returns the text object's format.
QPointF position() const
Returns the line's position relative to the text layout's position.
QList< QTextFrame * > childFrames() const
Returns a (possibly empty) list of the frame's child frames.
QTextLayoutStruct layoutCell(QTextTable *t, const QTextTableCell &cell, QFixed width, int layoutFrom, int layoutTo, QTextTableData *tableData, QFixed absoluteTableY, bool withPageBreaks)
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Q_OUTOFLINE_TEMPLATE RandomAccessIterator qLowerBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value)
qreal minimumWidth() const
The minimum width the layout needs.
VerticalAlignment verticalAlignment() const
Returns the vertical alignment used for characters with this format.
QString preeditAreaText() const
Returns the text that is inserted in the layout before editing occurs.
QFixed leftPadding(const QTextFormat &format) const
void setWidth(qreal w)
Sets the inline object's width to w.
QTextLength width() const
Returns the width of the frame's border rectangle.
The QTextLayout class is used to lay out and render text.
static Qt::Alignment visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment)
Transforms an alignment of Qt::AlignLeft or Qt::AlignRight without Qt::AlignAbsolute into Qt::AlignLe...
bool nonBreakableLines() const
Returns true if the lines in the paragraph are non-breakable; otherwise returns false.
int userType() const
Returns the storage type of the value stored in the variant.
QTextDocumentLayout(QTextDocument *doc)
#define Q_DECLARE_PUBLIC(Class)
int dynamicPageCount() const
void setPosition(const QPointF &p)
Moves the text layout to point p.
void draw(QPainter *painter, const PaintContext &context)
Draws the layout with the given painter using the given context.
The QTimerEvent class contains parameters that describe a timer event.
iterator begin()
Returns an STL-style iterator pointing to the first item in the vector.
static QTextFrameData * data(QTextFrame *f)
int firstPosition() const
Returns the first valid position in the document occupied by this cell.
The QTextInlineObject class represents an inline object in a QTextLayout.
The QFont class specifies a font used for drawing text.
QTextBlock findBlock(int pos) const
Returns the text block that contains the {pos}-th character.
The QGradient class is used in combination with QBrush to specify gradient fills. ...
void ensureLayoutedByPosition(int position) const
static bool isEmptyBlockAfterTable(const QTextBlock &block, const QTextFrame *previousFrame)
QPoint toPoint() const
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rou...
void setAscent(qreal a)
Sets the inline object's ascent to a.
QTextLine createLine()
Returns a new text line to be laid out if there is text to be inserted into the layout; otherwise ret...
qreal naturalTextWidth() const
Returns the width of the line that is occupied by text.
Q_GUI_EXPORT int qt_defaultDpi()
void adjust(qreal x1, qreal y1, qreal x2, qreal y2)
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
uint findNode(int k, uint field=0) const
QFixedPoint cellPosition(int row, int col) const
void drawInlineObject(QPainter *p, const QRectF &rect, QTextInlineObject item, int posInDocument, const QTextFormat &format)
This function is called to draw the inline object, object, with the given painter within the rectangl...
void setTextOption(const QTextOption &option)
Sets the text option structure that controls the layout process to the given option.
qreal bottomMargin() const
Returns the paragraph's bottom margin.
QList< T > values() const
Returns a list containing all the values in the hash, in an arbitrary order.
virtual void drawObject(QPainter *painter, const QRectF &rect, QTextDocument *doc, int posInDocument, const QTextFormat &format)=0
Draws this text object using the specified painter.
void addUpdateRectForFloat(const QRectF &rect)
QVariant property(int propertyId) const
Returns the property specified by the given propertyId.
int rows() const
Returns the number of rows in the table.
T & last()
Returns a reference to the last item in the vector.
QFixed effectiveTopMargin
Q_DECL_CONSTEXPR const T & qBound(const T &min, const T &val, const T &max)
void setBrush(const QBrush &brush)
Sets the painter's brush to the given brush.
qreal rightMargin() const
Returns the width of the frame's right margin in pixels.
The QTextFrameFormat class provides formatting information for frames in a QTextDocument.
The QTextTableCell class represents the properties of a cell in a QTextTable.
QBrush borderBrush() const
Returns the brush used for the frame's border.
The QAbstractTextDocumentLayout::PaintContext class is a convenience class defining the parameters us...
int size() const
Returns the number of items in the list.
The QTextLength class encapsulates the different types of length used in a QTextDocument.
The QTextBlockFormat class provides formatting information for blocks of text in a QTextDocument...
void setPen(const QColor &color)
Sets the painter's pen to have style Qt::SolidLine, width 0 and the specified color.
QBrush foreground() const
Returns the brush used to render foreground details, such as text, frame outlines, and table borders.
QPaintDevice * paintDevice() const
Returns the paint device used to render the document's layout.
void ensureLayoutFinished() const
if(void) toggleToolbarShown
qreal lineHeight(qreal scriptLineHeight, qreal scaling) const
Returns the height of the lines in the paragraph based on the height of the script line given by scri...
qreal value(qreal maximumLength) const
Returns the effective length, constrained by the type of the length object and the specified maximumL...
static QFixedSize fromSizeF(const QSizeF &s)
WrapMode wrapMode() const
Returns the text wrap mode defined by the option.
QFixed findY(QFixed yFrom, const QTextLayoutStruct *layoutStruct, QFixed requiredWidth) const
int lastPosition() const
Returns the last valid position in the document occupied by this cell.
The QTextOption class provides a description of general rich text properties.
const QObjectList & children() const
Returns a list of child objects.
Qt::LayoutDirection textDirection() const
Returns the resolved text direction.
Q_DECLARE_TYPEINFO(QCheckPoint, Q_PRIMITIVE_TYPE)
void drawRect(const QRectF &rect)
Draws the current rectangle with the current pen and brush.
QFixedPoint cellPosition(const QTextTableCell &cell) const
bool isValid() const
Returns true if this is a valid table cell; otherwise returns false.
int lineSpacing() const
Returns the distance from one base line to the next.
qreal y() const
Returns the y-coordinate of this point.
The QTextDocument class holds formatted text that can be viewed and edited using a QTextEdit...
bool isValid() const
Returns true if this text block is valid; otherwise returns false.
qreal top() const
Returns the y-coordinate of the rectangle's top edge.
static QFixed flowPosition(const QTextFrame::iterator it)
void setHeight(qreal h)
Sets the height to the given height.
Qt::Alignment alignment() const
Returns the text alignment defined by the option.
void ensureLayouted(qreal)
int length
Specifies the numer of characters the format range spans.
The QTextTableFormat class provides formatting information for tables in a QTextDocument.
QTextCharFormat format
Specifies the format to apply.
int lineHeightType() const
This returns the LineHeightType property of the paragraph.
The QTextList class provides a decorated list of items in a QTextDocument.
void setWrapMode(WrapMode wrap)
Sets the option's text wrap mode to the given mode.
The QBasicTimer class provides timer events for objects.
QTextCharFormat toCharFormat() const
Returns this format as a character format.
The QFontMetricsF class provides font metrics information.
void setWidth(qreal w)
Sets the width of the rectangle to the given width.
QTextFrame * parentFrame() const
Returns the parent frame of the current frame.
QTextFrame::Iterator frameIteratorForTextPosition(int position) const
bool isEmpty() const
Returns true if the vector has size 0; otherwise returns false.
PageBreakFlags pageBreakPolicy() const
Returns the currently set page break policy for the frame/table.
RenderHints renderHints() const
Returns a flag that specifies the rendering hints that are set for this painter.
bool atEnd() const
Returns true if the current item is the last item in the text frame.
void setCacheEnabled(bool enable)
Enables caching of the complete layout information if enable is true; otherwise disables layout cachi...
void reserve(int size)
Attempts to allocate memory for at least size elements.
qreal rawValue() const
Returns the constraint value that is specific for the type of the length.
qreal width() const
Returns the inline object's width.
QVector< QFixed > maxWidths
void endLayout()
Ends the layout process.
qreal bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
iterator insertMulti(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
int intProperty(int propertyId) const
Returns the value of the property specified by propertyId.
int columnSpan() const
Returns the number of columns this cell spans.
void pageCountChanged(int newPages)
This signal is emitted when the number of pages in the layout changes; newPages is the updated page c...
void setViewport(const QRectF &viewport)
QVector< Selection > selections
the collection of selections that will be rendered when passing this paint context to QAbstractTextDo...
QRectF translated(qreal dx, qreal dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
qreal border() const
Returns the width of the border in pixels.
int height() const
Returns the height of the font.
virtual QRectF frameBoundingRect(QTextFrame *frame) const
Returns the bounding rectangle of frame.
void setLayoutData(QTextFrameLayoutData *data)
QImageIOHandler * handler
qreal cellPadding() const
Returns the table's cell padding.
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.
int xToCursor(qreal x, CursorPosition=CursorBetweenCharacters) const
Converts the x-coordinate x, to the nearest matching cursor position, depending on the cursor positio...
QTextDocumentPrivate * docPrivate
QFixed topPadding(const QTextFormat &format) const
virtual void timerEvent(QTimerEvent *e)
This event handler can be reimplemented in a subclass to receive timer events for the object...
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
QTextBlock currentBlock() const
Returns the current block the iterator points to.
BorderStyle
This enum describes different border styles for the text frame.
static void markFrames(QTextFrame *current, int from, int oldLength, int length)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
int size() const
Returns the number of items in the vector.
QTextFrameFormat frameFormat() const
Returns the frame's format.
int indent() const
Returns the list format's indentation.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
QFixed cellWidth(int column, int colspan) const
qreal leftMargin() const
Returns the paragraph's left margin.
QTextBlockFormat blockFormat() const
Returns the QTextBlockFormat that describes block-specific properties.
qreal height() const
Returns the line's height.
int hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const
Returns the cursor postion for the given point with the specified accuracy.
void resizeInlineObject(QTextInlineObject item, int posInDocument, const QTextFormat &format)
Sets the size of the inline object item corresponding to the text format.
QVector< QTextLength > columnWidthConstraints() const
Returns a list of constraints used by this table format to control the appearance of columns in a tab...
int selectionStart() const
Returns the start of the selection or position() if the cursor doesn't have a selection.
QTextOption::WrapMode wordWrapMode
void beginLayout()
Begins the layout process.
int textStart() const
Returns the start of the line from the beginning of the string passed to the QTextLayout.
qreal toReal(bool *ok=0) const
Returns the variant as a qreal if the variant has type() Double , QMetaType::Float ...
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
static bool isEmptyBlockBeforeTable(const QTextBlock &block, const QTextBlockFormat &format, const QTextFrame::Iterator &nextIt)
const QBrush & text() const
Returns the text foreground brush of the current color group.
int lineCount() const
Returns the number of lines in this text layout.
static qreal toReal(Register *reg, int type, bool *ok=0)
iterator begin() const
Returns an iterator pointing to the first document element inside the frame.
The QList class is a template class that provides lists.
QRectF naturalTextRect() const
Returns the rectangle covered by the line.
BorderStyle borderStyle() const
Returns the style of the frame's border.
The QAbstractTextDocumentLayout class is an abstract base class used to implement custom layouts for ...
QTextLength lengthProperty(int propertyId) const
Returns the value of the property given by propertyId.
void removeAt(int i)
Removes the item at index position i.
QTextLayout * layout() const
Returns the QTextLayout that is used to lay out and display the block's contents. ...