QTfrontend/ui/widget/frameTeam.cpp
changeset 6970 59f33a6a4814
parent 6952 7f70f37bbf08
child 6977 6a2ecad333da
--- a/QTfrontend/ui/widget/frameTeam.cpp	Tue May 01 00:22:10 2012 +0200
+++ b/QTfrontend/ui/widget/frameTeam.cpp	Tue May 01 11:39:11 2012 +0200
@@ -56,15 +56,16 @@
 
 void FrameTeams::resetColors()
 {
-    currentColor=availableColors.end() - 1; // ensure next color is the first one
+    currentColor = availableColors.last(); // ensure next color is the first one
 }
 
 QColor FrameTeams::getNextColor() const
 {
-    QList<QColor>::ConstIterator nextColor=currentColor;
-    ++nextColor;
-    if (nextColor==availableColors.end()) nextColor=availableColors.begin();
-    return *nextColor;
+    int idx = availableColors.indexOf(currentColor);
+
+    idx = ++idx % availableColors.size();
+
+    return availableColors.at(idx);
 }
 
 void FrameTeams::addTeam(HWTeam team, bool willPlay)