Commit f9b11c73 authored by Frédéric Larue's avatar Frédéric Larue
Browse files

GradientWidget emits the valueChanged() signal only when the content effectively changed.

parent f9530bcf
......@@ -224,17 +224,36 @@ void GradientWidget::setStops( const QList<QColor>& colors, const QList<float>&
assert( colors.size() == values.size() );
assert( !colors.empty() );
m_Stops.clear();
bool changed = false;
QVector<Stop> newStops;
auto c = colors.begin();
auto v = values.begin();
int i = 0;
while( c != colors.end() )
{
addStop( *c, *v );
if( i < m_Stops.size() )
changed |= (m_Stops[i].color() != *c || m_Stops[i].value() != *v);
else
changed = true;;
++ i;
Stop stop( *c, *v );
stop.updateX( width()-1 );
newStops.insert( getInterval(*v), stop );
++ c;
++ v;
}
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