Commit c31ea194 authored by Frédéric Larue's avatar Frédéric Larue

Bug fixed in the GradientWidget::setStops() function.

parent 632fba2a
......@@ -226,7 +226,8 @@ void GradientWidget::setStops( const QList<QColor>& colors, const QList<float>&
assert( !colors.empty() );
bool changed = false;
QVector<Stop> newStops;
QVector<Stop> stopsBackup = m_Stops;
m_Stops.clear();
auto c = colors.begin();
auto v = values.begin();
......@@ -234,16 +235,16 @@ void GradientWidget::setStops( const QList<QColor>& colors, const QList<float>&
int i = 0;
while( c != colors.end() )
{
if( i < m_Stops.size() )
changed |= (m_Stops[i].color() != *c || m_Stops[i].value() != *v);
if( i < stopsBackup.size() )
changed |= (stopsBackup[i].color() != *c || stopsBackup[i].value() != *v);
else
changed = true;;
changed = true;
++ i;
Stop stop( *c, *v );
stop.updateX( width()-1 );
newStops.insert( getInterval(*v), stop );
m_Stops.insert( getInterval(*v), stop );
++ c;
++ v;
......@@ -251,7 +252,6 @@ void GradientWidget::setStops( const QList<QColor>& colors, const QList<float>&
if( changed )
{
m_Stops = newStops;
emit gradientModified();
update();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment