Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.4.0
Description
The fix from QTBUG-33548 does not correct all scenarios. Consider the following code that place text behind and in front of a transparent rectangle. Both text items are rasterized when only the one behind needs to be.
Also the text in front of a gradient is rasterized unnecessarily. See the attached PDF example file.
#include <QtPrintSupport> #include <QtGui> int main(int argc, char *argv[]) { QApplication a(argc, argv); QPrinter p; QPrintDialog d(&p); if(d.exec()) { QPainter painter(&p); QFont f("Helvetica", 30); painter.setFont(f); painter.setPen(Qt::gray); painter.drawText(100, 50, "A simple line of text behind."); painter.fillRect(0,40,1200,70,QColor(100,0,0,50)); painter.drawText(100, 120, "A simple line of text in front."); QLinearGradient linearGrad(QPointF(0, 0), QPointF(100, 100)); linearGrad.setColorAt(0, Qt::black); linearGrad.setColorAt(1, Qt::white); linearGrad.setSpread(QGradient::RepeatSpread); painter.fillRect(0,300,1200,70,linearGrad); painter.drawText(100, 315, "A simple line of text on top of a gradient."); } return 0; }