diff options
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qdistancefield.cpp | 11 | ||||
-rw-r--r-- | src/gui/text/qdistancefield_p.h | 1 | ||||
-rw-r--r-- | src/gui/text/qtextdocument.cpp | 2 | ||||
-rw-r--r-- | src/gui/text/qtextdocumentlayout.cpp | 39 | ||||
-rw-r--r-- | src/gui/text/qtextengine.cpp | 2 |
5 files changed, 45 insertions, 10 deletions
diff --git a/src/gui/text/qdistancefield.cpp b/src/gui/text/qdistancefield.cpp index 471a39a6e1..4d189786a1 100644 --- a/src/gui/text/qdistancefield.cpp +++ b/src/gui/text/qdistancefield.cpp @@ -833,6 +833,17 @@ QDistanceField::QDistanceField(QFontEngine *fontEngine, glyph_t glyph, bool doub setGlyph(fontEngine, glyph, doubleResolution); } +QDistanceField::QDistanceField(const QPainterPath &path, glyph_t glyph, bool doubleResolution) +{ + QPainterPath dfPath = path; + dfPath.translate(-dfPath.boundingRect().topLeft()); + dfPath.setFillRule(Qt::WindingFill); + + d = QDistanceFieldData::create(dfPath, doubleResolution); + d->glyph = glyph; +} + + QDistanceField::QDistanceField(QDistanceFieldData *data) : d(data) { diff --git a/src/gui/text/qdistancefield_p.h b/src/gui/text/qdistancefield_p.h index 95bb3b11c7..c376e93abe 100644 --- a/src/gui/text/qdistancefield_p.h +++ b/src/gui/text/qdistancefield_p.h @@ -97,6 +97,7 @@ public: QDistanceField(int width, int height); QDistanceField(const QRawFont &font, glyph_t glyph, bool doubleResolution = false); QDistanceField(QFontEngine *fontEngine, glyph_t glyph, bool doubleResolution = false); + QDistanceField(const QPainterPath &path, glyph_t glyph, bool doubleResolution = false); QDistanceField(const QDistanceField &other); bool isNull() const; diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index d243cf0b13..e8dd663354 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -1453,7 +1453,7 @@ QTextCursor QTextDocument::find(const QRegExp & expr, int from, FindFlags option \overload Finds the next occurrence, matching the regular expression, \a expr, in the document. - The search starts at the position of the given \a from cursor, and proceeds + The search starts at the position of the given from \a cursor, and proceeds forwards through the document unless specified otherwise in the search options. The \a options control the type of search performed. The FindCaseSensitively option is ignored for this overload, use QRegExp::caseSensitivity instead. diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index a00dac61fb..3a86a454ac 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -1115,6 +1115,13 @@ void QTextDocumentLayoutPrivate::drawTableCell(const QRectF &cellRect, QPainter const QFixed leftPadding = td->leftPadding(fmt); const QFixed topPadding = td->topPadding(fmt); + qreal topMargin = (td->effectiveTopMargin + td->cellSpacing + td->border).toReal(); + qreal bottomMargin = (td->effectiveBottomMargin + td->cellSpacing + td->border).toReal(); + + const int headerRowCount = qMin(table->format().headerRowCount(), table->rows() - 1); + if (r >= headerRowCount) + topMargin += td->headerHeight.toReal(); + if (td->border != 0) { const QBrush oldBrush = painter->brush(); const QPen oldPen = painter->pen(); @@ -1142,13 +1149,6 @@ void QTextDocumentLayoutPrivate::drawTableCell(const QRectF &cellRect, QPainter break; } - qreal topMargin = (td->effectiveTopMargin + td->cellSpacing + td->border).toReal(); - qreal bottomMargin = (td->effectiveBottomMargin + td->cellSpacing + td->border).toReal(); - - const int headerRowCount = qMin(table->format().headerRowCount(), table->rows() - 1); - if (r >= headerRowCount) - topMargin += td->headerHeight.toReal(); - drawBorder(painter, borderRect, topMargin, bottomMargin, border, table->format().borderBrush(), cellBorder); @@ -1159,7 +1159,30 @@ void QTextDocumentLayoutPrivate::drawTableCell(const QRectF &cellRect, QPainter const QBrush bg = cell.format().background(); const QPointF brushOrigin = painter->brushOrigin(); if (bg.style() != Qt::NoBrush) { - fillBackground(painter, cellRect, bg, cellRect.topLeft()); + const qreal pageHeight = document->pageSize().height(); + const int topPage = pageHeight > 0 ? static_cast<int>(cellRect.top() / pageHeight) : 0; + const int bottomPage = pageHeight > 0 ? static_cast<int>((cellRect.bottom()) / pageHeight) : 0; + + if (topPage == bottomPage) + fillBackground(painter, cellRect, bg, cellRect.topLeft()); + else { + for (int i = topPage; i <= bottomPage; ++i) { + QRectF clipped = cellRect.toRect(); + + if (topPage != bottomPage) { + const qreal top = qMax(i * pageHeight + topMargin, cell_context.clip.top()); + const qreal bottom = qMin((i + 1) * pageHeight - bottomMargin, cell_context.clip.bottom()); + + clipped.setTop(qMax(clipped.top(), top)); + clipped.setBottom(qMin(clipped.bottom(), bottom)); + + if (clipped.bottom() <= clipped.top()) + continue; + + fillBackground(painter, clipped, bg, cellRect.topLeft()); + } + } + } if (bg.style() > Qt::SolidPattern) painter->setBrushOrigin(cellRect.topLeft()); diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 0dd8442a71..076b6bbde4 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1707,7 +1707,7 @@ bool QTextEngine::isRightToLeft() const itemize(); // this places the cursor in the right position depending on the keyboard layout if (layoutData->string.isEmpty()) - return qApp ? qApp->inputMethod()->inputDirection() == Qt::RightToLeft : false; + return QGuiApplication::inputMethod()->inputDirection() == Qt::RightToLeft; return layoutData->string.isRightToLeft(); } |