From a671072fe6bdbda75fabc414287ff0c746dda2a7 Mon Sep 17 00:00:00 2001 From: vsr Date: Fri, 31 Oct 2014 16:43:41 +0300 Subject: [PATCH] IPAL52559: TC7.5.0: Auto color has no effect on the faces group --- src/SMESHGUI/SMESHGUI.cxx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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; -- 2.30.2