]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/selectionmode/backgroundcolorhelper.cpp
Improve code quality
[dolphin.git] / src / selectionmode / backgroundcolorhelper.cpp
index 4477d0f2c1dedb4376067a934032f344acd47f0c..fc540315253d06eb7f8b6f6f8d00604e095edfa0 100644 (file)
@@ -54,9 +54,11 @@ void BackgroundColorHelper::slotPaletteChanged()
 {
     updateBackgroundColor();
     for (auto i = m_colorControlledWidgets.begin(); i != m_colorControlledWidgets.end(); ++i) {
-        if (!*i) {
+        while (!*i) {
             i = m_colorControlledWidgets.erase(i);
-            continue;
+            if (i == m_colorControlledWidgets.end()) {
+                break;
+            }
         }
         setBackgroundColorForWidget(*i, m_backgroundColor);
     }
@@ -83,7 +85,8 @@ void BackgroundColorHelper::updateBackgroundColor()
     }
 
     m_backgroundColor = QColor::fromHsv(newHue,
-                                        // Saturation should be closer to the active color because otherwise the selection mode color might overpower it.
+                                        // Saturation should be closer to the saturation of the active color
+                                        // because otherwise the selection mode color might overpower it.
                                         .7 * activeBackgroundColor.saturation() + .3 * positiveBackgroundColor.saturation(),
                                         (activeBackgroundColor.value() + positiveBackgroundColor.value()) / 2,
                                         (activeBackgroundColor.alpha() + positiveBackgroundColor.alpha()) / 2);