use static stops list in QGradient::stops()

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2020-07-09 12:12:05 +00:00
parent 6969e2412c
commit 7d1130337b

View file

@ -1323,9 +1323,10 @@ void QGradient::setStops(const QGradientStops &stops)
QGradientStops QGradient::stops() const
{
if (m_stops.isEmpty()) {
QGradientStops tmp;
tmp << QGradientStop(0, Qt::black) << QGradientStop(1, Qt::white);
return tmp;
static const QGradientStops stops = QGradientStops()
<< QGradientStop(0, Qt::black)
<< QGradientStop(1, Qt::white);
return stops;
}
return m_stops;
}