Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.2.4, 6.10
-
None
-
Ubuntu 24.04 LTS
Description
- In a QTextLayout, assign a pen for the text's outline and Qt::NoBrush for the text's foreground:
QTextLayout textLayout("Qt"); QTextLayout::FormatRange range; range.start = 0; range.length = 2; range.format.setFont(f); range.format.setTextOutline(pen); range.format.setForeground(Qt::NoBrush); textLayout.setFormats(QList<QTextLayout::FormatRange>{range});
- Draw this using a QPainter:
textLayout.draw(&p, QPoint(0, 200));
Expected: The drawn characters will not be filled, i.e. inside the outline, they will be transparent:
Actual: The drawn characters are filled with the color of the outline's pen:
I attached a small project to reproduce the issue. It also draws a rectangle for comparison.
Workaround: Setting the foreground to Qt::transparent draws the expected shape.
Attachments
Issue Links
- resulted from
-
QTBUG-126268 Text rendering does not handle fill and stroke opacities correctly
-
- In Review
-
Gerrit Reviews
For Gerrit Dashboard: QTBUG-136696 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
644479,1 | WIP: Remove workaround for broken brush handling in QTextCharFormat | dev | qt/qtsvg | Status: NEW | -2 | 0 |