Details
-
Bug
-
Resolution: Invalid
-
P2: Important
-
None
-
5.15.2, 6.5.0 Beta1
-
None
Description
This testcase: gradients.cpp shows that
background-color: qlineargradient(...)
does not render the gradient correctly. Compare with the QPainter code, which renders the gradient as expected:
The problem comes from QGradient::ObjectBoundingMode (which is what src/gui/text/qcssparser.cpp uses), since the issue can actually be reproduced by changing the QPainter code to say
QLinearGradient gradient(0.50, 1, 0.58, 0); gradient.setCoordinateMode(QGradient::ObjectBoundingMode);
Note that using ObjectMode (given that ObjectBoundingMode is actually deprecated) makes no difference (which makes sense given that there's no transform applied to the painter).
From the documentation I assume this mode simply means "please multiply with the width and height of the object, respectively", but looking at QPainterPrivate::drawStretchedGradient and stretchGradientToUserSpace() in qpainter.cpp, it seems more complicated than that...