From e174969c15396ce76ca0a6942e16488513c3417f Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 19 Oct 2017 10:38:34 +0200 Subject: [PATCH] HighlightScrollbar: Avoid creation of unneeded temporary container Change-Id: I764f8f376b4a626d5258abb2fdd4ec7484b2c8c9 Reviewed-by: David Schulz --- src/plugins/coreplugin/find/highlightscrollbar.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/plugins/coreplugin/find/highlightscrollbar.cpp b/src/plugins/coreplugin/find/highlightscrollbar.cpp index 3c6f8b12044..03be40b693c 100644 --- a/src/plugins/coreplugin/find/highlightscrollbar.cpp +++ b/src/plugins/coreplugin/find/highlightscrollbar.cpp @@ -293,10 +293,11 @@ void HighlightScrollBarOverlay::paintEvent(QPaintEvent *paintEvent) QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing, false); - foreach (Utils::Theme::Color themeColor, highlights.keys()) { - const QColor &color = creatorTheme()->color(themeColor); - for (int i = 0, total = highlights[themeColor].size(); i < total; ++i) { - const QRect rect = highlights[themeColor][i]; + const auto highlightEnd = highlights.cend(); + for (auto highlightIt = highlights.cbegin(); highlightIt != highlightEnd; ++highlightIt) { + const QColor &color = creatorTheme()->color(highlightIt.key()); + for (int i = 0, total = highlightIt.value().size(); i < total; ++i) { + const QRect rect = highlightIt.value().at(i); painter.fillRect(rect, color); } }