From 1c9eb6da9a3b95d5ba614eb09e24f66e229f4b3d Mon Sep 17 00:00:00 2001 From: isn Date: Tue, 20 Oct 2015 13:24:25 +0300 Subject: [PATCH] static qvector of color --- src/HYDRO_tests/TestViewer.cxx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/HYDRO_tests/TestViewer.cxx b/src/HYDRO_tests/TestViewer.cxx index 7dcec1aa..5863579a 100644 --- a/src/HYDRO_tests/TestViewer.cxx +++ b/src/HYDRO_tests/TestViewer.cxx @@ -67,14 +67,17 @@ Handle(AIS_InteractiveContext) context() QColor TestViewer::GetColor(int i) { - QVector aCV; - aCV << QColor(0,0,255) - << QColor(0,255,0) - << QColor(255,0,0) - << QColor(255,255,20) - << QColor(20,255,255) - << QColor(100,100,20) - << QColor(10,100,150); + static QVector aCV; + if (aCV.isEmpty()) + { + aCV << QColor(0,0,255) + << QColor(0,255,0) + << QColor(255,0,0) + << QColor(255,255,20) + << QColor(20,255,255) + << QColor(100,100,20) + << QColor(10,100,150); + } return aCV[i]; } -- 2.39.2