diff options
Diffstat (limited to 'src/gui/text/qtextdocumentlayout.cpp')
-rw-r--r-- | src/gui/text/qtextdocumentlayout.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index 9d70873590..72267e9380 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -2123,7 +2123,7 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p { Q_Q(const QTextDocumentLayout); const QTextBlockFormat blockFormat = bl.blockFormat(); - const QTextCharFormat charFormat = QTextCursor(bl).charFormat(); + const QTextCharFormat charFormat = bl.charFormat(); QFont font(charFormat.font()); if (q->paintDevice()) font = QFont(font, q->paintDevice()); @@ -2186,9 +2186,11 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p painter->setRenderHint(QPainter::Antialiasing); + const bool marker = bl.blockFormat().marker() != QTextBlockFormat::MarkerType::NoMarker; if (selectionFormat) { painter->setPen(QPen(selectionFormat->foreground(), 0)); - painter->fillRect(r, selectionFormat->background()); + if (!marker) + painter->fillRect(r, selectionFormat->background()); } else { QBrush fg = charFormat.foreground(); if (fg == Qt::NoBrush) @@ -2198,19 +2200,21 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p QBrush brush = context.palette.brush(QPalette::Text); - bool marker = bl.blockFormat().marker() != QTextBlockFormat::MarkerType::NoMarker; if (marker) { int adj = fontMetrics.lineSpacing() / 6; r.adjust(-adj, 0, -adj, 0); + const QRectF outer = r.adjusted(-adj, -adj, adj, adj); + if (selectionFormat) + painter->fillRect(outer, selectionFormat->background()); if (bl.blockFormat().marker() == QTextBlockFormat::MarkerType::Checked) { - // ### Qt6: render with QStyle / PE_IndicatorCheckBox. We don't currently + // ### Qt7: render with QStyle / PE_IndicatorCheckBox. We don't currently // have access to that here, because it would be a widget dependency. painter->setPen(QPen(painter->pen().color(), 2)); painter->drawLine(r.topLeft(), r.bottomRight()); painter->drawLine(r.topRight(), r.bottomLeft()); painter->setPen(QPen(painter->pen().color(), 0)); } - painter->drawRect(r.adjusted(-adj, -adj, adj, adj)); + painter->drawRect(outer); } switch (style) { @@ -2357,9 +2361,10 @@ QTextLayoutStruct QTextDocumentLayoutPrivate::layoutCell(QTextTable *t, const QT floatMinWidth = qMax(floatMinWidth, cd->minimumWidth); } - // constraint the maximumWidth by the minimum width of the fixed size floats, to - // keep them visible + // constraint the maximum/minimumWidth by the minimum width of the fixed size floats, + // to keep them visible layoutStruct.maximumWidth = qMax(layoutStruct.maximumWidth, floatMinWidth); + layoutStruct.minimumWidth = qMax(layoutStruct.minimumWidth, floatMinWidth); // as floats in cells get added to the table's float list but must not affect // floats in other cells we must clear the list here. @@ -2536,6 +2541,8 @@ recalc_minmax_widths: for (int n = 0; n < cspan; ++n) { const int col = i + n; QFixed w = widthToDistribute / (cspan - n); + if (td->maxWidths[col] != QFIXED_MAX) + w = qMax(td->maxWidths[col], w); td->maxWidths[col] = qMax(td->minWidths.at(col), w); widthToDistribute -= td->maxWidths.at(col); if (widthToDistribute <= 0) |