From: vsr Date: Fri, 31 Oct 2014 13:43:41 +0000 (+0300) Subject: IPAL52559: TC7.5.0: Auto color has no effect on the faces group X-Git-Tag: V7_5_0b1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=91444946c40d3b9b13b4e633f1e1cd277a7f9c89;p=modules%2Fsmesh.git IPAL52559: TC7.5.0: Auto color has no effect on the faces group --- diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 0f8f8d31e..61ff14fb5 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -1756,6 +1756,19 @@ namespace return RefType; } + uint randomize( uint size ) + { + static bool initialized = false; + if ( !initialized ) { + qsrand( QDateTime::currentDateTime().toTime_t() ); + initialized = true; + } + uint v = qrand(); + v = uint( (double)( v ) / RAND_MAX * size ); + v = qMax( uint(0), qMin ( v, size-1 ) ); + return v; + } + } //namespace void SMESHGUI::OnEditDelete() @@ -6939,7 +6952,7 @@ SALOMEDS::Color SMESHGUI::getPredefinedUniqueColor() } } } - static int currentColor = 0; + static int currentColor = randomize( colors.size() ); SALOMEDS::Color color; color.R = (double)colors[currentColor].red() / 255.0;