These functions should return by-value, not by-pointer:
QBrush::gradient()[*EDIT*: QGradient is not implicitly-shared]
The old API design is from the days of Qt 1, where the return types were not implicitly-shared. However, this is no longer the case.
Here's an abandoned initial attempt: https://codereview.qt-project.org/#/c/101233/10//ALL