┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/selectionmode/backgroundcolorhelper.cpp
diff options
context:
space:
mode:
authorFelix Ernst <[email protected]>2022-04-25 12:52:05 +0200
committerFelix Ernst <[email protected]>2022-08-14 14:42:40 +0000
commit78cffd2979a6ed87e044fcb024cf4fdfc5c7cb3d (patch)
tree7e5b66a5b4fc8c3328949d80898be2d1d57da5b7 /src/selectionmode/backgroundcolorhelper.cpp
parent8e55f2c2409fd6ca9ebc66a6568f4d3bcbef7576 (diff)
Improve code quality
Diffstat (limited to 'src/selectionmode/backgroundcolorhelper.cpp')
-rw-r--r--src/selectionmode/backgroundcolorhelper.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/selectionmode/backgroundcolorhelper.cpp b/src/selectionmode/backgroundcolorhelper.cpp
index 4477d0f2c..fc5403152 100644
--- a/src/selectionmode/backgroundcolorhelper.cpp
+++ b/src/selectionmode/backgroundcolorhelper.cpp
@@ -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);