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^0 X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=commitdiff_plain;h=a671072fe6bdbda75fabc414287ff0c746dda2a7;hp=3f66560195eeda497be96e1f44729cfc9c18354c 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;