Fix printing of table headers in multi-frame QTextDocuments

The calculation of page position of table headers would only work
correctly for tables in the root frame of a QTextDocument. Fix by
including the relative positions of subframes.

Fixes: QTBUG-59000
Change-Id: I2cc7e21bddf806f7f5f9b0675ac014c339ba2453
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
Eirik Aavitsland 2019-04-11 15:29:44 +02:00
parent 3d4b62a753
commit 83dccf00cc

View File

@ -970,8 +970,14 @@ void QTextDocumentLayoutPrivate::drawFrame(const QPointF &offset, QPainter *pain
if (pageHeight <= 0)
pageHeight = QFIXED_MAX;
const int tableStartPage = (td->position.y / pageHeight).truncate();
const int tableEndPage = ((td->position.y + td->size.height) / pageHeight).truncate();
QFixed absYPos = td->position.y;
QTextFrame *parentFrame = table->parentFrame();
while (parentFrame) {
absYPos += data(parentFrame)->position.y;
parentFrame = parentFrame->parentFrame();
}
const int tableStartPage = (absYPos / pageHeight).truncate();
const int tableEndPage = ((absYPos + td->size.height) / pageHeight).truncate();
qreal border = td->border.toReal();
drawFrameDecoration(painter, frame, fd, context.clip, frameRect);