Use const_iterator instead. Fix range-loop-detach Clazy warning. Indeed when using C++11 range-loops, the .begin() and .end() functions are called, instead of .cbegin() and .cend(). This imply before looping over the QMap, it may perform a deep-copy of it (if shared). See also the explanation given by Qt documentation of qAsConst(). Another solution is to use "std::as_const" cast on the QMap object. Signed-off-by: Benjamin ROBIN <dev@xxxxxxxxxxxxx> --- src/KsGLWidget.cpp | 5 +++-- src/plugins/KVMComboDialog.cpp | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/KsGLWidget.cpp b/src/KsGLWidget.cpp index 9e3dac3..0a44e77 100644 --- a/src/KsGLWidget.cpp +++ b/src/KsGLWidget.cpp @@ -137,9 +137,10 @@ void KsGLWidget::paintGL() /* Draw the time axis. */ _drawAxisX(size); - for (auto const &stream: _graphs) - for (auto const &g: stream) + for (auto it = _graphs.cbegin(), end = _graphs.cend(); it != end; ++it) { + for (auto const &g: it.value()) g->draw(size); + } for (auto const &s: _shapes) { if (!s) diff --git a/src/plugins/KVMComboDialog.cpp b/src/plugins/KVMComboDialog.cpp index 2b95a53..6be68d4 100644 --- a/src/plugins/KVMComboDialog.cpp +++ b/src/plugins/KVMComboDialog.cpp @@ -308,13 +308,15 @@ void KsComboPlotDialog::_applyPress() int nPlots(0); _plotMap[guestId] = _streamCombos(guestId); - for (auto const &stream: _plotMap) - for (auto const &combo: stream) { + + for (auto it = _plotMap.cbegin(), end = _plotMap.cend(); it != end; ++it) { + for (auto const &combo: it.value()) { allCombosVec.append(2); combo[0] >> allCombosVec; combo[1] >> allCombosVec; ++nPlots; } + } emit apply(nPlots, allCombosVec); } -- 2.43.0