OSDN Git Service

use static stops list in QGradient::stops()
authorIvailo Monev <xakepa10@laimg.moc>
Thu, 9 Jul 2020 12:12:05 +0000 (12:12 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Thu, 9 Jul 2020 12:12:05 +0000 (12:12 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
src/gui/painting/qbrush.cpp

index 8f487b2..78dc81b 100644 (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;
 }